Query YouTube API for most liked videos - youtube

I am experimenting with YouTube's API, and I am trying to figure out how to return an ordered list of videos by the most number of likes.
I know I can access the number of likes using the video list query, but that is not going to get me what I need.
I need the search query response to have the videos already sorted by most liked.
Is there any query to the API that will do that?
Thanks,
Nathan

The YouTube API does not support ordering video search results by likes.

Order by rating order=rating and number of results with maxResults= For example:
fetch(`https://www.googleapis.com/youtube/v3/search?&channelId=${CHANNEL_ID}&maxResults=1&order=rating&type=video&key=${API_KEY}`)

Related

YouTube API V3 difficulties while fetching top channels based on specific country

I want to fetch top channels (i.e top 10,100,150 channels) based on their subscribers and view count for specific country, How can I do that?
I have tried to use
https://www.googleapis.com/youtube/v3/search
but there is not any way found to fetch/search top YouTube channels with this API call, and not other way found for my need
Note: Tried regionCode parameter but that's not for filter the channels it fetching based on videos viewing in specific country
Thank you for your help in advance
What you want to do is not currently possible with this api.
search.list
Supports searching on a single region code
The Q paramater only does a fulltext search on the description and title of the video
There is no way to sort on either channels or subscribers.

Get youtube old trending videos

Working with YouTube Data API v3, to get the most popular videos i'm using:
https://www.googleapis.com/youtube/v3/videos?part=contentDetails&chart=mostPopular&regionCode=IN&maxResults=25&key=API_KEY
But i need old trending video by a specific date.
I tried publishedBefore=2016-09-21 but it gives today trending videos.
Update: if this is not possible with YouTube Data API just a website/ database where i can find old youtube trending by date and country will do it for me.
Update2: using search not working because i don't need a keyword
Please Help
Don't think publishedBefore works in videos.list. You are using Videos.list API call but this doesn't have a publishedBefore property. This filter only exist in Search.list. However, I've noticed there's no mostPopular parameter in Search.list as well.
So, what I can suggest is use the order paramter with "rating" as value in Search.list.
Here's a sample URL call:
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&maxResults=25&order=rating&publishedBefore=2016-01-01T00%253A00%253A00Z&q=dogs&type=video&fields=*&_h=8&

Explore videos with youtube api

Can i with youtube api explore videos without added search keyword e.g. popular videos per country,new videos,last comments videos or something like that where i can get videos without added search keyword ?
You can check out the Video Feeds developer guide to search for most popular videos and other feeds. You can also limit it to a certain user, country, etc.
In v3, you can use chart=mostPopular option of youtube.search.list.
https://developers.google.com/youtube/v3/guides/implementation/videos#videos-retrieve-most-popular-videos
If you want to get TOP 10 videos in Geographic areas, 7DayTotals, 30DayTotals, ..., you can use dimensions of YouTube Analytics API.
https://developers.google.com/youtube/analytics/v1/dimsmets/dims

Youtube api v3 list ordered playlist items

Is there a way to order videos from a playlist using PlaylistItems:list? For example, when using the API to fetch related videos to a video using Search:list, you can order the videos returned by date, rating, relevance, etc.
The docs entry for PlaylistItems:list doesn't show such a feature, so I would say it's impossible to do it directly.
You could achieve this manually, though, by fetching all the videos' data and writing an algorithm that orders them.

Channel Search in Youtube Data API within a particular category

I want to get all the channels within one particular category say "X".How can i achieve this using youtube data API?
Getting all the channels is easy and we can get these on the basis of searched keyword.
With the Youtube API v3 the channels can be filtered by the Freebase topic ID, besides keyword
https://developers.google.com/youtube/v3/docs/search/list

Resources