Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support yt hashtags #102

Open
umputun opened this issue Dec 20, 2022 · 3 comments
Open

support yt hashtags #102

umputun opened this issue Dec 20, 2022 · 3 comments

Comments

@umputun
Copy link
Owner

umputun commented Dec 20, 2022

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)

@rantanevich
Copy link
Contributor

I could find only several ways to extract video hashtags:

  1. Make GET request to https://www.youtube.com/watch?v={VideoID} and extract hashtags using RegExp (e.g. "keywords":\[(.+?)\],).

  2. 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.

@umputun
Copy link
Owner Author

umputun commented May 18, 2023

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

@rantanevich
Copy link
Contributor

My bad. Now I understand the problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants