Advertisement
Guest User

bubb4dump

a guest
Jan 11th, 2021
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.63 KB | None | 0 0
  1. #!/bin/sh
  2. ID='5f9f61c9389f1af859e15be1'
  3. JWT_TOKEN='' # optional
  4. LIMIT=100
  5.  
  6. get() {
  7.     curl -s \
  8.         -XGET \
  9.         --url "https://api.streamelements.com/kappa/v2/songrequest/$ID/history?limit=$LIMIT&offset=$1" \
  10.         -H 'Accept: application/json'
  11.     # -H "Authorization: Bearer $JWT_TOKEN"
  12. }
  13.  
  14. main() {
  15.     firstpage=$(get 0)
  16.     total=$(echo "$firstpage" | jq '.total')
  17.     sleep 1s
  18.     {
  19.         echo "$firstpage"
  20.         for i in $(seq 100 100 "$total"); do
  21.             echo >&2 "getting $i/$total"
  22.             get "$i"
  23.             sleep 1s
  24.         done
  25.     } | jq -sc '[.[].history|.[]]'
  26. }
  27.  
  28. main "$@"
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement