如何在欧盟中使用Head请求识别YouTube短裤视频

发布于 2025-01-30 05:56:36 字数 783 浏览 4 评论 0原文

我正在使用YouTube数据API V3来提取有关我的YouTube频道的信息。 我想确定短裤,以便我可以分开分析。 我在另一项讨论中发现了一个解决方案,该解决方案是在“ https://www.youtube.com/shorts/videoid”上发出主题,因为如果不是很短的话,它应该重定向到URL一。

不幸的是,无论我是否经过短暂的响应[302]>。 我怀疑这是因为我在欧盟中,如果我尝试访问URL而不登录的URL,我将重定向到cookie同意页面: https://consent.youtube.com/m?continue=https%3A%2F%2F%2f%2f%2FWWWWW.Youtube.com2fshorts%2F-2F-2MHZGXTXSOSO; pc = yt& uxe = eomty& hl = en& src = 1

是这样吗? 如果是这样,是否有解决方法? (除了VPN之外)

预先感谢 我会很乐意在其他讨论中发表评论,而不是创建另一个主题,但我是一个没有声誉的简单潜伏者,所以我在这里无法评论的

是原始对话:我如何从youtube API数据v3 中获得YouTube短裤

I'm using YouTube Data API V3 to extract info about my YouTube channel.
I'd like to identify Shorts so I can analyze them separately.
I've found in another discussion a solution which is to do a head request at "https://www.youtube.com/shorts/videoId" as it should redirect the URL if it's not a short and it should not if it is one.

Unfortunately, regardless of if I'm passing a Short or not I get <Response [302]>.
I suspect this is because I'm in the EU and if I try to access the URL without being logged-in I'm redirected to the cookie consent page: https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2Fshorts%2F-2mHZGXtXSo%3Fcbrd%3D1&gl=DE&m=0&pc=yt&uxe=eomty&hl=en&src=1

Is that the case?
If so, is there any workaround? (aside from a VPN)

Thanks in advance,
I would have gladly commented on the other discussion instead of creating another topic but I'm a simple lurker with no reputation so I can't comment

Here is the original conversation: how do i get youtube shorts from youtube api data v3

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦明 2025-02-06 05:56:36

遇到了这一点,并试图识别短裤。事实证明,发送同意的cookie值=是+将绕过同意屏幕。在Python中,这可能看起来像:

requests.head(shorts_link, cookies={"CONSENT": "YES+"})

Ran into this as well trying to identify shorts. Turns out, sending a cookie value of CONSENT=YES+ will bypass the consent screen. In Python, this might look like:

requests.head(shorts_link, cookies={"CONSENT": "YES+"})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文