Reputation: 1
I am trying to get videos of a particular channel (like :- Luis Fonsi) in highest views order
. And I am passing order parameter
to sort the response by viewCount
like :-
order=viewCount
URL :-
When I try to run it then It is not sorting as I expected. I was expecting first song would be Despacito
But It got another one which definitely don't have the highest views.
As mentioned in Youtube-API Documentation
in search section.
viewCount – Resources are sorted from highest to lowest number of views.
It is not working like this.
I have tried many times but it is still not working.
Any help would be much Appreciated.
Upvotes: 0
Views: 535
Reputation: 5612
YouTube Data API v3 is broken on some aspects, if I were you, I would just retrieve all videos from the given YouTube channel and then sort them.
To do so:
uploads
playlist id by using Channels: list with part=contentDetails
.playlistId=UPLOADS_PLAYLIST_ID
(replacing
UPLOADS_PLAYLIST_ID
with the one you just obtained).part=statistics
with Videos:
list.Upvotes: 0