Youtube API does not return updated results

I am developing a simple video application that initiates an Intent to receive a new video update from a specific channel using Youtube Api V3 .

search.setKey(Constant.DEVELOPER_KEY); search.setChannelId(channelID); search.setOrder("date"); search.setPublishedAfter(new DateTime(yesterday)); search.setType("video"); search.setFields("items(id/kind,id/videoId,snippet/title,snippet/publishedAt)"); search.setMaxResults((long) 50); SearchListResponse searchResponse = search.execute(); List<SearchResult> searchResultList = searchResponse.getItems(); 

Problem: It returns me a list of not updated results.

Example URL: https://www.googleapis.com/youtube/v3/search?part=snippet&order=date&type=video&channelId=UC52X5wxOL_s5yw0dQk7NtgA&key=your_api_key&maxResults=50

Description of the problem:

  • Over the course of several days, observing this behavior, I found out that, firstly, there is always another video that I could find on this channel by going to the Youtube website. And the video just needs, like another 30 or 60 minutes, in my search results.

  • It’s good that the delay is actually fine for me, I don’t understand, someday, let's say there is video 1, video 2 and video 3, where 1 is uploaded to 2 and 2 is uploaded to 3. In the above case, I would expect the result (in the URL that I specified to sort by desc) is 3-2-1, or 2-1, or only 1. But what I get is weird, 3-1, 2 will come later, maybe through half an hour. I mean, if the problem with the delay, at least it should appear in the list with the correct ordering?

Expected Solution: In order to get a search result that will be ordered by date exactly, so whenever I try to request a video, I just need to get what was published after my last received video. Not like in my example, getting everything from yesterday.

Thanks for your time, I'm really looking for a solution.

+4
source share
1 answer

So, at first the V3 API is currently experimental, and I would not recommend using it until it was signed and what not.

Secondly, I am never a fan of client libraries and prefer to make API calls directly, so you can make sure that the call is made the way you want. So, for example, here is a simple call to retrieve videos from my channel in the order they were published: http://gdata.youtube.com/feeds/api/videos?orderby=published&author=ahmednuaman

I would recommend using this method at the moment and take a look at the interactive API demonstration ( http://gdata.youtube.com/demo/index.html ) before brew up your call and confirm that the tests return the data you need.

0
source

All Articles