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.
source share