YouTubes API for getting the latest videos from a channel

时间:2019-03-19 15:07:54

标签: youtube youtube-api youtube-data-api

I am trying to get the latest, up to date videos from a channel on youtube. Not sure why, but order: 'date', , publishedAfter: '2019-03-13T19:14:31.000Z', and publishedBefore: '2019-02-13T19:14:31.000Z', don't seem to have an effect.

The full code of what I'm using is here below:

baseURL: 'https://www.googleapis.com/youtube/v3',
params: {
    part: 'snippet',
    publishedAfter: '2019-03-13T19:14:31.000Z',
    publishedBefore: '2019-02-13T19:14:31.000Z',
    order: 'date',
    maxResults: 10,
    key: KEY,
    channelId: 'UCzQUP1qoWDoEbmsQxvdjxgQ'
}

Is youtube messing around with the API? Is there a special way we are meant to be doing this? Maybe my ordering is wrong? I'm quite confused

2 个答案:

答案 0 :(得分:1)

根据Google论坛,这是一个临时性问题:https://support.google.com/youtube/thread/2494861?msgid=2520468

  

YouTube意识到搜索/排序功能无法正常工作-这是暂时的,也是我们为更好地回应,查看和删除YouTube中违反图形的内容而做出的努力的一部分。

答案 1 :(得分:1)

此问题与以下问题有关:

另请参阅Google的问题#128673552,https://issuetracker.google.com/issues/128673552

此问题的解决方法:改为使用PlaylistItems端点,查询频道的上传列表。但是,您应该注意视频的发布时间上传时间https://developers.google.com/youtube/v3/docs/videos#snippet.publishedAt)之间的区别。