Trying to search for all the most viewed youtube videos by title, missing search results

Viewed 170

My goal is to find all the most viewed youtube videos with "Godot" in the title.

Using just the youtube UI I search for "Godot" and in Filters select "Type - Video" and "Sort by - View count": https://www.youtube.com/results?search_query=godot&sp=CAMSAhAB

It shows me a list of videos, but many search results are missing. For example if you look at a popular Godot youtube channel, their most popular video with "Godot" in the title does appear in search results, the second most popular one doesn't. Basically, some of the videos from this channel do appear on the list, but others don't (even though they have a very high view count).

When I use the Youtube API and try to do the same thing, I get the same results.

Why? Can someone help me to figure out a way to get all the most viewed youtube videos with "Godot" in the title?

1 Answers

Don't forget when looking for title containing exactly godot to add quotation mark around ("), then with your modified link I achieve to get both videos you specified: https://www.youtube.com/results?search_query="godot"&sp=CAMSAhAB

However on the YouTube API the quotation mark method doesn't work.

My solution:

Use the following CURL request which shows in its answer both videos you mentionned:

curl -s 'https://www.youtube.com/youtubei/v1/search?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' -H 'Content-Type: application/json' --data-raw '{"context":{"client":{"clientName":"WEB","clientVersion":"2.2022011"}},"query":"\"godot\"","params":"CAM="}'

Note: don't pay attention to the key it's not a YouTube Data API v3 key.

Related