Open umputun opened 1 year ago
I could find only several ways to extract video hashtags:
Make GET
request to https://www.youtube.com/watch?v={VideoID}
and extract hashtags using RegExp (e.g. "keywords":\[(.+?)\],
).
Make the following request and get JSON response with hashtags
❯ VIDEO_ID=kFRdoYfZYUY
❯ resp=$(curl \
'https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' \
-s \
-X POST \
-H 'Content-Type: application/json' \
-d @- <<EOF
{
"videoId": "$VIDEO_ID",
"context": {
"client": {
"clientName": "IOS",
"clientVersion": "17.33.2"
}
}
}
EOF
)
❯ echo -E "$resp" | jq -r .videoDetails.keywords
[
"Hania Rani",
"Live from Studio S2",
"Piano",
"Live",
"Warsaw",
"Poland",
"Piano Day"
]
But here there's pinch of magic. key
param is INNERTUBE_API_KEY
which can be changed anytime by Google.
This is somewhat opposite to what we need if I understood the idea correctly. This snippet seems to retrieve tags for a given video, but what we are looking for something to get the list of video ids (in some form) for a given tag
My bad. Now I understand the problem :)
I don't think youtube provides rss for hashtags, but having such sources will be very useful. It can probably be extracted from hashtag page (looks like it embeds all the relevant data in
"responseContext
as a json)