Ring
Ring

Reputation: 2309

YouTube Data API search not honoring publish after date

I have this query

    YouTube.Search.List search = youtube.search().list("id");
    search.setOrder("viewCount");
    search.setMaxResults(50);
    search.setPublishedAfter(new DateTime(publishedAfterDate));
    search.setPublishedBefore(new DateTime(new Date()));
    search.setType("video");
    search.setKey(getYoutubeKey());

Which was working perfectly fine up until a few months ago. Then, all of a sudden it seems that Google must have changed something in their data API and the "PublishedAfter" date is no longer being honored.

I checked in a debugger and the value of "publishedAfterDate" resolves just fine. My query for videos published after one week ago is now returning videos from a year ago. There are no errors or anything of that sort, the API just doesn't return the correct results when the same exact code was working perfectly fine a few months ago.

Any ideas?

Live demo

Full source

Another weird tidbit, on the live demo if you click "All Time", you'll notice that the data API is even returning the same videos more than once. This is very weird and also didn't used to happen a few months ago.

Upvotes: 2

Views: 1655

Answers (1)

Related Questions