2

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)

2
  • 2
    Unfortunately this is not supported for playlistItems. Maybe someday? You could try reading in the entire playlist and doing the sort yourself. Commented Sep 29, 2015 at 12:53
  • @johnh10 you should post that as an answer. Commented Sep 30, 2015 at 6:33

3 Answers 3

2

Unfortunately this is not supported for playlistItems. You could try reading in the entire playlist and doing the sort yourself.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

This answer is for searches and not playlistItems like requested.
-1

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

4 Comments

The documentation link you have is for YouTube API v2, you just pasted it on a link for YouTube API v3. Are you sure that version 3 of the api supports orderby?
developers.google.com/youtube/v3/docs/playlistItems/list then its not documented. You might want to change your link to a v3 link instead of a link to v2. Oh and file a bug to so Google can fix the documentation. That it does work in v3 and it just isn't listed.
sorry my friend it doesn't work. googleapis.com/youtube/v3/…{key}&orderby=relevance I tested with ( position ,commentCount ,duration, published ,title ) Would have been nice if it had I have been looking for this.
If you check the discovery api you can see its not part of the api either. googleapis.com/discovery/v1/apis/youtube/v3/rest

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.