youtube data api search by viewCount wrong results

Solution 1:

Easy workaround:

Use my YouTube operationnal API, make a GET request to https://yt.lemnoslife.com/search?part=snippet&channelId=*channelId*&order=viewCount

A bit more complicated workaround:

curl -s 'https://www.youtube.com/youtubei/v1/browse?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' -H 'Content-Type: application/json' --data-raw '{"context":{"client":{"clientName":"WEB","clientVersion":"2.2022011"}},"browseId":"CHANNEL_ID","params":"EgZ2aWRlb3MYASAAMAE="}'

Don't forget to replace CHANNEL_ID with the channelId you want the most viewed videos from.

If you need more than the first 30 results, grab the continuation token from the response of the request above and use the following command (and if you're still interested for more results use the last continuation token you got):

curl -s 'https://www.youtube.com/youtubei/v1/browse?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' -H 'Content-Type: application/json' --data-raw '{"context":{"client":{"clientName":"WEB","clientVersion":"2.2022011"}},"continuation":"CONTINUATION_TOKEN"}'

Don't forget to replace CONTINUATION_TOKEN with the continuation token you got from the latest request reponse.

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