Created
October 27, 2017 18:38
-
-
Save Pmmlabs/ce80d53acc7d187fdcb58ea9c886d985 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
JQ="jq" | |
TEMP="temp.json" | |
COMMENTS="comments.txt" | |
CURSOR="" | |
PARAM="" | |
echo "" > ${TEMP} | |
echo "" > ${COMMENTS} | |
while [ "$CURSOR" != "null" ] | |
do | |
[ -z "$CURSOR" ] && echo 1 || PARAM="cursor=$CURSOR" | |
curl "https://api.twitch.tv/v5/videos/$VIDEO/comments?$PARAM" -H "client-id: $CLIENT_ID" --compressed > ${TEMP} | |
${JQ} -r '.comments|.[]|"[" + (.content_offset_seconds/3600|floor|tostring) + ":" + (.content_offset_seconds%3600/60|floor|tostring) + ":" + (.content_offset_seconds%60|floor|tostring) + "] " + .commenter.name + ": " + .message.body' ${TEMP} >> $COMMENTS | |
CURSOR=`${JQ} -r "._next" ${TEMP}` | |
done | |
echo "DONE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is an token error when adding a channel witch contains topic Food \u0026 Drink
solution: TOKEN="
echo $RESP | $JQ '.token' | sed 's/\\\\"/"/g' | sed 's*\\\\**' | sed 's/\(^.\)//g' | sed 's/\(.$\)//g'
"