51 lines
2.8 KiB
Bash
Executable File
51 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ "${get_data[v]}" == '' && "${get_data[cont]}" == '' ]]; then
|
|
echo "pffft"
|
|
return
|
|
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')" #'
|
|
else
|
|
cont="${get_data[cont]}"
|
|
fi
|
|
|
|
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[] |
|
|
if(.reloadContinuationItemsCommand != null) then
|
|
.reloadContinuationItemsCommand.continuationItems[]
|
|
else
|
|
.appendContinuationItemsAction.continuationItems[]
|
|
end')"
|
|
|
|
|
|
jq -r 'select(.commentsHeaderRenderer) | "<h3>(whole \(.commentsHeaderRenderer.countText.runs[0].text) of them)</h3>"' <<< "$comments" | head -1
|
|
jq -r '(if (.commentThreadRenderer != null) then
|
|
.commentThreadRenderer | select(.comment.commentRenderer.authorText.simpleText != null)
|
|
else
|
|
.commentRenderer
|
|
end | (
|
|
if (.comment.commentRenderer != null) then
|
|
.comment.commentRenderer
|
|
else
|
|
.
|
|
end |
|
|
"</pre></div><div class='"'"'comment'"'"'><a href='"'"'\(.authorEndpoint.commandMetadata.webCommandMetadata.url)'"'"'><img src='"'"'\(.authorThumbnail.thumbnails[0].url)'"'"'>\(.authorText.simpleText)</a> \(.publishedTimeText.runs[].text)<br><pre>",
|
|
(.contentText.runs[] | if .bold == true then "<b>\(.text)</b>" else .text end),
|
|
(select(.voteCount.simpleText != null) | "<br><small>\(.voteCount.simpleText) liked</small>")
|
|
),
|
|
(select(.replies.commentRepliesRenderer) | "<div class='"'"'show-more'"'"' data-fun='"'"'replies'"'"' data-uwu='"'"'\(.replies.commentRepliesRenderer.contents[0].continuationItemRenderer.continuationEndpoint.continuationCommand.token)'"'"'>Show replies</div>"))
|
|
' <<< "$comments" | sed -E 's/^$/<br>/g'
|
|
echo "</pre></div>"
|
|
|
|
jq -r '
|
|
if (.continuationItemRenderer.continuationEndpoint) then
|
|
select(.continuationItemRenderer.continuationEndpoint.continuationCommand.token) | "<div class='"'"'show-more'"'"' data-fun='"'"'more'"'"' data-uwu='"'"'\(.continuationItemRenderer.continuationEndpoint.continuationCommand.token)'"'"'>Load more...</div>"
|
|
else
|
|
select(.continuationItemRenderer.button.buttonRenderer.command.continuationCommand.token) | "<div class='"'"'show-more'"'"' data-fun='"'"'replies-more'"'"' data-uwu='"'"'\(.continuationItemRenderer.button.buttonRenderer.command.continuationCommand.token)'"'"'>More replies...</div>"
|
|
end' <<< "$comments" | tail -1
|