Reputation: 1167
I am trying to get the list of video sorted by most viewed you tube video.I have been trying the following code but it is not returning any response.
var request = gapi.client.youtube.search.list({
part: 'snippet,contentDetails,statistics',
q: query,
maxResults: count,
order:'viewCount'
});
request.execute(onSearchResponse);
Above code does not return any response.Can someone please redirect me in right direction I have already looked into documentation.
https://developers.google.com/youtube/v3/docs/search/list
Upvotes: 0
Views: 660
Reputation: 2575
Using the YouTube API v3 (and modifying the parameters supplied in this answer), you can use this request URL for get the most viewed YouTube video.
https://www.googleapis.com/youtube/v3/search?key=<YOUR_API_KEY>&part=snippet&order=viewcount&maxResults=1
The following information was taken from the YouTube Data API - official documentation:
snippet
.viewcount
.1 Linked documentation says that only these values are allowed in the order
parameter:
Upvotes: 1