Created
April 15, 2020 14:41
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Usage: ./extract-product-list.sh foodgrains.json > foodgrains.txt | |
jq -j '.ProductList[] | .product[] | .Name, " (Price: ", .Price, ", Offer Price: ", .sale_price, ")\n"' $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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