Search code examples
youtube-data-api

How to make publishedAfter field working?


I'm trying to get videos of a particular channel using search/list API method. But looks like publishedAfter field doesn't work.

Example: https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCgxTPTFbIbCWfTR9I2-5SeQ&maxResults=50&order=date&publishedAfter=2019-01-01T00:00:00Z&type=video&key=MYKEY

"totalResults": 1546,
...
{
   "kind": "youtube#searchResult",
   "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/ZrInvdAerhIEEIuhaU-Op01jNGQ\"",
   "id": {
    "kind": "youtube#video",
    "videoId": "lkHUuL_qBKc"
   },
   "snippet": {
    "publishedAt": "2018-10-05T16:45:52.000Z",
    "channelId": "UCgxTPTFbIbCWfTR9I2-5SeQ",
    "title": "🔥 Путин обманул. Квартира за 2 млрд. ГРУ",
    ...

There are less than 150 videos with publishedAt > 1st of January, but API returns 1546 videos and the results contain videos, that were published before 1st of January, the above example shows 5th of October, 2018. Looks like API ignores publishedAfter condition as well as order=date.

It's weird, but two days ago the same url with the same key gave correct results.

Is it possible to get correct search results?


Solution

  • It's not your fault. Right now, it's seems like a global problem. Read here - https://support.google.com/youtube/thread/2494861?hl=en My youtube app is broken too.