gpt4 book ai didi

java - Youtube api显示来自用户播放列表android的有限视频

转载 作者:太空狗 更新时间:2023-10-29 13:23:41 26 4
gpt4 key购买 nike

我尝试使用以下 json url 显示来 self 的 youtube channel 的所有视频。但此网址仅显示 25 个视频。

https://gdata.youtube.com/feeds/api/videos?author=Anklespankin&v=2&alt=jsonc

实际上用户已经上传了超过500个视频

https://www.youtube.com/user/Anklespankin

如何获取所有视频。给我json解决方案。

我有引用Youtube Api to fetch all videos on a Channel这个链接,但那里有解决方案

   https://www.googleapis.com/youtube/v3/search?key={your_key_here}&channelId={channel_id_here}&part=snippet,id&order=date&maxResults=20"

但在这里我必须传递最大结果,如果我写超过 50 个我就不会得到任何结果

最佳答案

您不能通过一个电话来完成。你必须使用更多的电话来做到这一点。首先,您下载用户的前 20 个视频,使用:

https://gdata.youtube.com/feeds/api/videos?author=Anklespankin&v=2&alt=jsonc&start-index=1&max-results=20

然后你检查 totalItems 属性,看看他总共有多少个视频。如果超过 20,则通过偏移 start-index 获取其他的:

https://gdata.youtube.com/feeds/api/videos?author=Anklespankin&v=2&alt=jsonc&start-index=21&max-results=20
https://gdata.youtube.com/feeds/api/videos?author=Anklespankin&v=2&alt=jsonc&start-index=41&max-results=20

等等。当然,您可以使用更大的数字,例如 ma​​x-results=50,这样您就不必调用那么多了。

关于java - Youtube api显示来自用户播放列表android的有限视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24729840/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com