BAT / Brave Example Data, Sorting with jq on command line

in #brave6 years ago (edited)

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

Coin Marketplace

STEEM 0.15
TRX 0.17
JST 0.028
BTC 68866.74
ETH 2459.40
USDT 1.00
SBD 2.41