BAT / Brave Example Data, Sorting with jq on command line
Just a quick dump of examining the example data for ads that may ship with the launch of Brave Browser ads. For those just interested the interpreted data just look at the data dump section.
Data Dump
I'm using to the sample data sets provided on one of Brave's github repos.
How to
Download the data
Make sure programs needed are installed, I'm using jq
and wget
(optional).
sudo apt-get install jq wget
Download the data with the following commands:
wget https://raw.githubusercontent.com/brave-intl/bat-native-ads/master/mock_data/bundle.json
or without wget
:
curl wget https://raw.githubusercontent.com/brave-intl/bat-native-ads/master/mock_data/bundle.json > bundle.json
Get categories for ads
The bundle.json
is sorted by category with each object in the outer object being described by a category name. We can reduce to just seeing the categories with the following command:
cat bundle.json | jq 'map_values(keys)'
Get URLs from all ads in bundle
cat bundle.json | jq '.categories[][].notificationURL' bundle.json