A little treat for Halloween
Have you ever wondered where your precious precious BF4 reports are?
I did ...
the columns used:
and some slicers:
• get the reports IDs
• brute force through IE
• make an API call to get the data
• relevant link and documentation
• choosing the DB
• importing the data
• exporting the data
• use the data
GET THE REPORTS IDs:
the basic idea is to collect all the reports IDs of the games that were played.
Since I was not able to find anything similar to an API call to extract that first
needed data I did the next reasonable thing (at least for me) and it was automating
a tedious navigation task.
So: go to your reports and click "view more reports", inspect the various tables/div
with the built-in inspector and voilà, that's it. You'll see that the reports ID are
there, you just need to be a little creative with data carving. If you are used to
this you'll find it pretty trivial.
The only way I know to automate IE is through Visual Basic Script, so I basically wrote
a procedure that opens IE, navigates to my reports, clicks "view more reports" thousands and thousands
of times and collect a specific element by his Tag Name and gently ask to give me
one of its specific attribute.
In the end I decided to rewrite the script in VBA and coded directly inside Excel for
practical simplicity. So now I can quickly check if a specific ID was already downloaded etc.
MAKE AN API CALL TO GET THE DATA:
that's simpler than the previous part.
Look at this: https://github.com/akwaz/blAPI
having the list of reports and the relevant API call you can now develop something
to get the data. I coded it right in Excel with VBA.
Enjoy your reports saved one by one in JSON format
CHOOSING THE DB:
I don't know much about DBs, SQL Server aside I know very little. At the beginning I
was determined to write my own interpreter but after some analysis I decided not to
invest so much time in it.
Asking around I found out that MongoDB is pretty awesome at handling JSON data.
IMPORTING THE DATA:
at this stage you already have your precious reports saved so just install MongoDB.
Create a DB, create your new collection and import all the files.
Not having much familiarity with this tool and not knowing how it is supposed to be
automated I went the brutal way as always. Batch files FTW!
for %%f in (*.txt) do (
please import my files
I, obviously, called that .bat through VBA in Excel...just you know, I do everything
through Excel and probably not in the best way. But it works...so
Using this kludge I count for the records and verify if match with the reports count I've previously downloaded etc.
EXPORTING THE DATA:
that part is quite simple, you just need to investigate the JSON through something that transforms it in human-readable strings.
In this instance I used a plug-in for Notepad++, named JSON Viewer, to analyze the structure and choose
the columns to export. I started looking up Stack Overflow, you'll find everything and beyond.
USE THE DATA:
now that your data is in a table format, and practical to analyze, just use your preferred software
to do it
Would you like to guess what I used? Yes, Excel again!
You could use R, or even KNIME (and R) for some complex statistical analysis.
Could've been worse. You were lucky if twisted mirror was the only thing that broke.
Don't want to even think what would've happen for my bike...on my luck fairings and some other shit would've been broken
Luckily no crashes here yet.