Skip to content

Instantly share code, notes, and snippets.

@shirish87
Created April 15, 2020 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shirish87/1bb3f789879f027a8a6a3d8733ba5c0d to your computer and use it in GitHub Desktop.
Save shirish87/1bb3f789879f027a8a6a3d8733ba5c0d to your computer and use it in GitHub Desktop.
Scripts to extract product list (for organizing pooled orders to StarBazaar during COVID-19 lockdown)
#!/bin/bash -e
# Usage: ./extract-product-list.sh foodgrains.json > foodgrains.txt
jq -j '.ProductList[] | .product[] | .Name, " (Price: ", .Price, ", Offer Price: ", .sale_price, ")\n"' $@
#!/bin/bash -e
# Usage: ./scrape-category.sh 451 foodgrains.json
# Usage: ./scrape-category.sh 513 fresh.json
# Usage: ./scrape-category.sh 422 dairy.json
# Usage: ./scrape-category.sh 368 branded-food.json
# Usage: ./scrape-category.sh 600 personal-care.json
# env vars you set from using the website and checking network requests
userid=${userid:-default}
temptoken=${temptoken:-default}
storeid=${storeid:-1}
# /vars
start=1
limit=1000
curl -o "${2:-output.json}" "https://api.starquik.com/v1/category?cat_id=$1&limit=$limit&start=$start" -H "temptoken: $temptoken" -H 'Accept: application/json, text/plain, */*' -H "userid: $userid" -H 'device: desktop' -H 'Sec-Fetch-Dest: empty' -H "storeid: $storeid" --compressed ${@:3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment