1

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

etieno
  • 13
  • 4
  • 1
    You can try to read the hashtags of the video and if there is a #shorts then that would mean that it's a short – ZiyadCodes May 18 '22 at 14:35
  • Thanks I'll do that for now. Apparently it is no longer mandatory to add Short in the tags though, so it might not work 100% of the time but it's still much better than nothing – etieno May 19 '22 at 08:10
  • By `EU` you mean Europe, correct? If so, it looks like a weird behavior as I am also in Europe and not experiencing this issue. If you are still encountering this issue and interested to solve this problem, don't hesitate to [contact me](https://stackoverflow.com/users/7123660/benjamin-loison) to try to debug things together. – Benjamin Loison Oct 27 '22 at 11:50

1 Answers1

1

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+"})
Cev
  • 1,388
  • 1
  • 13
  • 18