* change comments to a legit API - thanks Lauren

This commit is contained in:
Dominika Liberda 2022-10-08 17:13:05 +00:00
parent 0fd785ca92
commit 04649561f0

View file

@ -6,8 +6,27 @@ if [[ "${get_data[v]}" == '' && "${get_data[cont]}" == '' ]]; then
fi
if [[ "${get_data[cont]}" == '' ]]; then # tactical replies, INCOMING
vid="$(curl -b cookiejar_ -H "Cookie: CONSENT=YES+1337" -s "https://www.youtube.com/watch?v=${get_data[v]}" -c cookiejar_)"
cont="$(grep -Poh 'token":"Eg0S.*?"' <<< "$vid" | sed -E 's/token"://;s/"//g' | head -n1)" #'
# vid="$(curl -b cookiejar_ -H "Cookie: CONSENT=YES+1337" -s "https://www.youtube.com/watch?v=${get_data[v]}" -c cookiejar_)"
# cont="$(grep -Poh 'token":"Eg0S.*?"' <<< "$vid" | sed -E 's/token"://;s/"//g' | head -n1)" #'
# the above still works but the below is more resilient?
vid="$(curl --request POST \
--url 'https://www.youtube.com/youtubei/v1/next?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--cookie CONSENT=PENDING%2B553 \
--data '{
"context": {
"client": {
"clientName": "WEB",
"clientVersion": "2.20211221.00.00",
"hl": "en",
"timeZone": "UTC",
"utcOffsetMinutes": 0
}
},
"videoId": "'"${get_data[v]}"'"
}')"
cont="$(jq -r '.contents.twoColumnWatchNextResults.results.results.contents[3].itemSectionRenderer.contents[0].continuationItemRenderer.continuationEndpoint.continuationCommand.token' <<< "$vid")"
else
cont="${get_data[cont]}"
fi