Reputation:
How to reverse this videos list?
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLYQWoSxgWOXMjtLQJIikS56pu7eJusSKW&maxResults=25&pageToken=CB4QAA&key=AIzaSyDEm5wGLsWi2G3WG40re-DAJcWioQSpJ6o
I need newest first! (by publishedAt sorting newest first)
Upvotes: 2
Views: 2522
Reputation: 4185
Unfortunately this is not supported for playlistItems. You could try reading in the entire playlist and doing the sort yourself.
Upvotes: 2
Reputation: 4037
You need to use the order parameter in your REST API call to fetch the video is some specific order. As mentioned in your question you need to fetch the data in sorted order where the published recently should be at the top. Hence you need to set the value of order to date in your REST API call. Other values that are supported, rating, relevance (by default), title, videoCount and ViewCount.
For additional details read the official documentation and also try the web service.
Upvotes: 0
Reputation: 5113
https://developers.google.com/youtube/2.0/developers_guide_protocol
Add orderby=time to your URL
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLYQWoSxgWOXMjtLQJIikS56pu7eJusSKW&maxResults=25&pageToken=CB4QAA&key=AIzaSyDEm5wGLsWi2G3WG40re-DAJcWioQSpJ6o&orderby=time
Upvotes: -1