Youtube API v3 上的上传播放列表更新速度很慢吗? [英] Are upload playlists on Youtube API v3 purpsofully slow to be updated?

查看:32
本文介绍了Youtube API v3 上的上传播放列表更新速度很慢吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的机器人中有一行 python 代码:

I have a line of python code in my bot:

    playlist_snippet = self.youtube.playlistItems().list(
        playlistId=playlistId, part='snippet',
        maxResults=50, pageToken=next_page_token
        ).execute()

playlistId 是用户上传播放列表的 id.我注意到这似乎是在 youtube 网站上的播放列表更新后 10 到 50 分钟以及等效的 API v2 调用后更新.

The playlistId is the id of the user upload playlist. I've noticed that this seems to be updated 10 - 50 mins after the playlist is updated on the youtube website and also the equivalent API v2 call.

有更好的 API 调用吗?这是故意不合时宜的吗?

Is there a better API call to make? Is this purposefully untimely?

附言对于任何感兴趣的人,这是我的代码:https://github.com/notatallshaw/arandabot/blob/master/ytvideos.py

p.s. for anyone interested this is my code: https://github.com/notatallshaw/arandabot/blob/master/ytvideos.py

我测试得越多,我得到的示例就越多,它需要一个多小时才能通过 API v3 与网站或 API v2 更新用户上传播放列表.

The more I test this the more I get examples of it taking over an hour to update the user upload playist via API v3 vs. the website or API v2.

推荐答案

是的,我注意到了这一点,我运行的机器人非常依赖速度,这是我一直使用 v2 而不是 v3、v3 的唯一原因太他妈慢了.但现在谷歌正在关闭 v2,是时候采取行动了.我在 v3 中找到的最快的端点是搜索端点,更新通常需要 60-120 秒(v2 上传端点立即更新)

Yep I have noticed this to, I run a bot that is pretty reliant on speed and this is the only reason I have been using v2 instead of v3, v3 is so god damn slow. But now that Google is shutting down v2 it's time to move. The fastest endpoint i've found in v3 is the search one, it usually takes like 60-120 seconds to update(the v2 uploads endpoint updated immediately)

像这样使用它:

https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&order=date&channelId={channelId}&key={api_key}

它会为您提供来自指定频道的最新上传.此外,在标题中包含:'Cache-Control': 'max-age=0, no-cache' 也有很大帮助.

and it will give you the latest upload from the specified channel. Also, having:'Cache-Control': 'max-age=0, no-cache' in your headers helps a good bit too.

这篇关于Youtube API v3 上的上传播放列表更新速度很慢吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆