通过 RSS 从 Youtube 播放列表中获取视频列表不会返回超过 15 个结果 [英] Fetching videos list from a Youtube playlist through RSS doesn't return more than 15 results
问题描述
我正在使用以下 API 来获取播放列表中的视频列表:
I'm using the following API to fetch a list of the videos in a playlist:
https://www.youtube.com/feeds/videos.xml?playlist_id=
问题是如果播放列表超过15个视频,响应只有前15个.我以为有分页算法,但是里面没有link rel="next"
响应并将 ?page
附加到链接的末尾会返回 404.
The problem is if the playlist has more than 15 videos, the response is only the first 15. I thought there is a paging algorithm, but there is no link rel="next"
in the response and appending ?page
to the end of the link returns 404.
谢谢
推荐答案
首先,YouTube 数据 API v2 调用已被弃用,并鼓励您使用 YouTube 数据 API (v3).
First, the YouTube Data API v2 call is already deprecated and encourage you to use the YouTube Data API (v3).
我在这个线程中发现https://www.youtube.com/feeds/videos.xml?playlist_id=xxxxx
仅限于 15 个视频或结果.
I found in this thread that https://www.youtube.com/feeds/videos.xml?playlist_id=xxxxx
is only limited to 15 videos or results.
旧 API 使用 max-results
和 start-index
以获得更多结果,但当我尝试时它不再起作用.
The old API use max-results
and start-index
to get more results but it is not working anymore when I try.
如果你想要超过 15 个结果,我建议你使用 PlaylistItems:YouTube 数据 API (v3) 的列表
.它有一个参数 maxResults
您可以设置为最多 50 个.要获得另一个或接下来的 50 个结果,您可以使用参数 pageToken
为它.
If you want more results than 15, I suggest you to use the PlaylistItems: list
of the YouTube Data API (v3). It has a parameter maxResults
that you can set to maximum of 50. To get the another or next 50 results, you can use the parameter pageToken
for it.
希望这些信息对您有所帮助.
Hope this information helps you.
这篇关于通过 RSS 从 Youtube 播放列表中获取视频列表不会返回超过 15 个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!