Reputation: 23
I'm trying to retrieve videos posted last 10 minuttes , but query is retrieving videos from 2015
After looking around in forums, only advice I found was try to add the PublishedBefore option, but that did not help either.
Upvotes: 1
Views: 1568
Reputation: 495
Our URL is below:
Note I have replaced our Channel ID and Access Token with substitute values for this post.
The publishedAfter parameter is not working and has never worked for us. This wasn't a problem until the March 15-16 timeframe when something changed w/ the YouTube API and the order parameter is no longer being considered by their service. Since that time, all videos are being returned by their API in order of upload date (for us, this means starting w/ 2015).
Upvotes: 0
Reputation: 17651
I managed to get this working. Here's the things you can double check. Make sure you are providing the correct date format as can be seen in the publishedAfter in the search.list:
2018-02-12T00:00:00Z
Also make sure the API Key you're using has the Youtube Data API "ENABLED" in your google dev console.
So, using your exact URI request, it looks like this:
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=25&publishedAfter= 2018-02-12T00:00:00Z
&q=surfing&key=API_KEY
Upvotes: 0
Reputation: 4185
I used your example and get the 2015 results, but it looks like your datetime is in the future. How did you calculate the datetime?
I just now used format 'Y-m-d\TH:i:s\Z' for '10 min ago' and the time is quite different. This link returned the expected results.
So even though I responded 13+ hours after your post, my datetime is still about 9 hours before your example.
Upvotes: 1