#!/bin/bash vid="$(curl -b cookiejar_ -H "Cookie: CONSENT=YES+1337" -s "https://www.youtube.com/watch?v=${get_data[v]}" -c cookiejar_)" # broken comment support, we need this for now cont="$(grep -Poh 'token":"Eg0S.*?"' <<< "$vid" | sed -E 's/token"://;s/"//g')" #' comments="$(curl -s 'https://www.youtube.com/youtubei/v1/next?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' \ --compressed -H 'Content-Type: application/json' \ --data-raw '{"context":{"client":{"hl":"en","gl":"GB","clientName":"WEB","clientVersion":"2.20210719.00.00","mainAppWebInfo":{}},"adSignalsInfo":{"params":[]}},"continuation":"'"$cont"'"}' \ | jq '.onResponseReceivedEndpoints[].reloadContinuationItemsCommand.continuationItems[]')" jq -r '"

\(.commentsHeaderRenderer.countText.runs[0].text) Comments

"' <<< "$comments" | head -1 jq -r '.commentThreadRenderer.comment.commentRenderer | select(.authorText.simpleText != null) | "
\(.authorText.simpleText)
", (.contentText.runs[] | if .bold == true then "\(.text)" else .text end)' <<< "$comments" | sed -E 's/^$/
/g'