To be frank - i have never used pagination/after parameters before so this is a new one for me.
Code:
Ask for Username
echo "What’s the username: "
read name
Curl for token
curl -X POST ‘https://id.twitch.tv/oauth2/token?client_id=’$client_id’&client_secret=’$client_secret’&grant_type=client_credentials&scope=user:read:email’ >> token.txt && awk -F ‘"’ ‘{print $4}’ token.txt >> token_only.txt
token=$(cat token_only.txt)
Get User ID
curl -H 'Client-ID: '$client_id -H 'Authorization: Bearer '$token 'https://api.twitch.tv/helix/users?login=’$name >> user_id.txt && awk -F ‘"’ ‘{print $6}’ user_id.txt >> uid_only.txt
user_id=$(cat uid_only.txt)
Get follow list for user
curl -H 'Client-ID: '$client_id -H 'Authorization: Bearer '$token ‘https://api.twitch.tv/helix/users/follows?to_id=’$user_id’&first=100’ | json_pp >> fl_list.txt
cat fl_list.txt | grep ‘“cursor”’ | awk -F ‘:’ ‘{print $2}’ | sed ‘s/"//g’ >> cursor.txt
cursor=$(cat cursor.txt)
curl -H 'Client-ID: '$client_id -H 'Authorization: Bearer '$token 'https://api.twitch.tv/helix/users/follows?to_id=’$user_id’&after=’$cursor -v | json_pp >> fl_list.txt
cat fl_list.txt | grep ‘“from_id”’ | awk -F ‘:’ ‘{print $2}’ | sed ‘s/"//g’ | sed ‘s/,//g’ >> clean_fl_list.txt
wc clean_fl_list.txt
Remove Token for next go
rm token* uid* user* fl_list* clean_fl* cursor*
in the curl output - it doesnt seem like its passing the data after the “after” parameter.
GET /helix/users/follows?to_id=<user_id>&after= HTTP/2
Host: api.twitch.tv
user-agent: curl/7.74.0
accept: /
any ideas anyone?