Youtube Data API v3: Sort by date not working
Asked Answered
A

4

14

The sorting is not working as expected since a few hours.

https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&channelId=UC_x5XG1OV2P6uZZ5FSM9Ttw&key=YOUR_API_KEY

Can be tried in the API explorer (Execute without OAuth) as well.

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&channelId=UC_x5XG1OV2P6uZZ5FSM9Ttw&order=date

date: Resources are sorted in reverse chronological order based on the date they were created.

https://developers.google.com/youtube/v3/docs/search/list

What is going wrong?

Armed answered 16/3, 2019 at 8:54 Comment(12)
I can confirm I am also seeing an issue with the YouTube API, so it's not specific to your API key. For me I'm seeing videos in pretty much random order, showing videos from 5 years ago next to videos from a month ago.Allman
Exactly, this is currently a blocker for my requirements. There must be an issue with the API.Armed
Hopefully it will resolve itself shortly, I believe it impacts every app that uses the YouTube API which should help get YouTube's attention.Allman
I hope so too. I can reproduce it without any changes since several hours.Armed
I no longer think they are in random order, I believe the result is sorted by rating instead of date. Maybe YouTube is experimenting with a new sorting method and it messed up the API.Allman
It looks like there are multiple posts on twitter trying to alert YouTube.Allman
The default value is relevance according to the documentation. In my request I have explicitly specified the parameter value "date". However, it seems that none of the accepted values are recognized. I've tested all of them with equal results. I hardly think that anything is happen on there before Monday.Armed
I can also confirm that it gives wrong results for a specific date.Paediatrician
This affects billions of apps & devices, hopefully they can get to it sooner than Monday.Allman
I have the same issue when searching for video's for a channelId. order=date is not reliable. One second new video's are there, moments later they're not, few seconds later they are there again. And then they're gone again and so forth.Marinetti
I tried it on https://developers.google.com/youtube/v3/docs/search/list and order=date sometimes leaves out items which should be there. The results are not consistent.Marinetti
Order by date has not been working for years. What I do is getting a maximum of 3 nextPageToken results back and order it in javascriptMarinetti
A
12

In case you are looking to get the latest videos of a channel:

  • Get the channels upload playlist from Channels
  • Get the latest videos in the channels upload playlist from PlaylistItems

Alternatively, you can use the channels RSS feed:

  • https://www.youtube.com/feeds/videos.xml?channel_id={ChannelId}
  • https://www.youtube.com/feeds/videos.xml?user={User}

This does not replace the full search sorted by date function however.

Thanks YouTube for making me work on a Sunday, all I wanted was to watch the latest videos from my favorite channels. At least I don't have to wait for a fix anymore, good luck to those less lucky!

Adelina answered 17/3, 2019 at 13:23 Comment(2)
PlaylistItems works if search terms and sort by rating, relevance, title, videoCount or viewCount are not required. In my case, the descending sorting is fortunately enough. I've already changed my app. Thanks.Armed
Thanks so much for this comment. This method works perfectly as the playlistItems.list() method happens to return videos in date descending order, which is exactly what I needed. I then just request more pages with nextPageToken. Thanks again!Coenocyte
K
2

Reports in Google's forum were commented by a Google employee: https://support.google.com/youtube/thread/2494861?msgid=2520468

YouTube is aware the search/sorting functions aren't working as expected – this is temporary and part of our efforts to better respond, review and remove graphic, violative content from YouTube. Thanks for your patience while we work through this. Will update this thread when these features are working normally again, feel free to subscribe for updates.

Khalif answered 18/3, 2019 at 16:52 Comment(1)
Thety should define temporary in terms of years.Marinetti
C
1

Bug reports for this include:

https://issuetracker.google.com/issues/128673031

https://issuetracker.google.com/issues/128673552

Both have an official comment from Google:

Thank you all for bringing this up here. These specific filters have been currently disabled on both YouTube.com and through the APIs. We should have updates on this soon. Thanks again.

Coenocyte answered 19/3, 2019 at 12:54 Comment(1)
Still no update on this. If only they provided us with a time frame on when this will be fixed.Dorkas
O
0

Not sure how credible that is:

Just confirming that this is only temporary, and related to YouTube's efforts to better respond, review and remove graphic, violative content from YouTube. Thanks for your patience while we work through this.

https://www.reddit.com/r/youtube/comments/b1plj5/sort_by_upload_date_not_working/eiojtjh/

Oversold answered 16/3, 2019 at 21:50 Comment(3)
Simply changing the API with countless applications is, of course, the only solution. As if it were not the case that all developers have stored an e-mail address for their API key that could have been used to inform them. For me it's a bug. And so far no comments from the development team. Of course, this "temporary" change had to happen for the weekend. Thank you Youtube, that my app has not been fully functional for more than 24 hours. Should I now load all data into the cache to sort them? No.Armed
True. You could – for the time being – use a service like RSS bridge (bridge.suumitsu.eu) if your app does not rely on additional data like view count or duration etc..Oversold
It's still not working...Marinetti

© 2022 - 2024 — McMap. All rights reserved.