invidious icon indicating copy to clipboard operation
invidious copied to clipboard

[Bug] Age Restricted Videos do not play

Open SimoonDude opened this issue 4 years ago • 47 comments

Videos that have been marked age-restricted don't play Any video with age-restriction doesn't work. All you can see is the thumbnail. I've tested this on all public instances.

Steps to reproduce the behavior:

  1. Go to any age-restricted video
  2. See error

Even the play button doesn't work image

Additional context

  • Browser: Latest Windows version of Chrome
  • OS: Win10 x64

SimoonDude avatar Jun 22 '21 19:06 SimoonDude

Yeah, I’ve been facing the same issue. It seems like a recent problem. I don’t know if it’s related to what is going on at youtube-dl. But I couldn’t download using youtube-dl either, and I’m not in the E.U. nor do I have a Google account.

Mennaruuk avatar Jun 22 '21 21:06 Mennaruuk

Can someone post a couple of age-restricted videos here? (this is for testing purposes though)

unixfox avatar Jun 24 '21 15:06 unixfox

https://www.youtube.com/watch?v=5gZCjMjoilo https://www.youtube.com/watch?v=fzhHXt7NKUs https://www.youtube.com/watch?v=cIVPYWyPqKA

Mennaruuk avatar Jun 24 '21 17:06 Mennaruuk

A 20$ bounty has been added to this issue.

Anyone opening a PR fixing this issue, will receive 20$ (in BTC) from the Invidious project.

More details: https://github.com/iv-org/invidious/issues/1898

TheFrenchGhosty avatar Jun 25 '21 12:06 TheFrenchGhosty

Note: the yt-dlp people found a way to get access to the video by (I think) using the mobile website's embed. However this only works with videos that can be embedded. Having this solution implemented is "enough" for you to get the bounty.

Related: https://github.com/yt-dlp/yt-dlp/commit/4e6767b5f2e2523ebd3dd1240584ead53e8c8905

TheFrenchGhosty avatar Jun 25 '21 13:06 TheFrenchGhosty

Just add &c=TVHTML5&cver=6.20180913 to https://github.com/iv-org/invidious/blob/993d731c92f6f07e4bee4a222c02e1e47d7f9d6e/src/invidious/videos.cr#L994

Note that this is a temporary fix and we expect it to break in the near future. See https://github.com/yt-dlp/yt-dlp/pull/328 for some fallbacks

pukkandan avatar Jun 25 '21 15:06 pukkandan

The x-youtube-client-version header would also have to be set to 6.20180913

syeopite avatar Jun 25 '21 15:06 syeopite

The x-youtube-client-version header would also have to be set to 6.20180913

No. get_video_info doesnt need x-youtube-client-version header

pukkandan avatar Jun 25 '21 15:06 pukkandan

Yep. However, Invidious appends those headers by default as seen in here: https://github.com/iv-org/invidious/blob/993d731c92f6f07e4bee4a222c02e1e47d7f9d6e/src/invidious/helpers/utils.cr#L4-L17

In order to get this fix to work, x-youtube-client-version would also have to be set to 6.20180913

syeopite avatar Jun 25 '21 15:06 syeopite

hm.. that is a problem. The header for all other requests should still be 2.20210407.08.00

Is it not possible to send this request without the header?

pukkandan avatar Jun 25 '21 15:06 pukkandan

Nope. If we want to use the connection pool, all of those headers would get added no matter what. The only workaround for this is to set x-youtube-client-version to 6.20180913 during the request function call since the add_yt_headers function doesn't override existing headers.

    required_parameters = URI::Params.new({
      "video_id" => [id],
      "eurl"     => ["https://youtube.googleapis.com/v/#{id}"],
      "html5"    => ["1"],
      "c"        => ["TVHTML5"],
      "cver"     => ["6.20180913"],
    })

    embed_info = HTTP::Params.parse(YT_POOL.client &.get("/get_video_info?#{required_parameters}", headers: HTTP::Headers{"x-youtube-client-version" => "6.20180913"}).body)

syeopite avatar Jun 25 '21 15:06 syeopite

Can this userscript be pasted somewhere into invidious? It worked for https://www.youtube.com/watch?v=KgmoMO66uPg :

https://raw.githubusercontent.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass/main/Simple-YouTube-Age-Restriction-Bypass.user.js#bypass=true

neurodiverseEsoteric avatar Jun 30 '21 16:06 neurodiverseEsoteric

Can this userscript be pasted somewhere into invidious? It worked for youtube.com/watch?v=KgmoMO66uPg :

zerodytrash/Simple-YouTube-Age-Restriction-Bypass@main/Simple-YouTube-Age-Restriction-Bypass.user.js#bypass=true (raw)

That's already what the PR #2205 is doing.

unixfox avatar Jun 30 '21 18:06 unixfox

Oh ok, nevermind then....

neurodiverseEsoteric avatar Jul 01 '21 17:07 neurodiverseEsoteric

Reopening as not every age restricted videos are unblocked.

unixfox avatar Jul 14 '21 17:07 unixfox

@unixfox can you name a problem video? I think I have a fix

Well this video used to not work with the fix for bypassing age restricted videos: https://www.youtube.com/watch?v=cIVPYWyPqKA but now it works :thinking:. I can't find a video that we can't bypass though.

We are still interested in your potential fix though.

unixfox avatar Jul 14 '21 18:07 unixfox

https://github.com/yt-dlp/yt-dlp/pull/328#issuecomment-864117168

Cr381pDsSsA is one that still doesn't play even after #2205

syeopite avatar Jul 14 '21 18:07 syeopite

Using cookies obviously work, the challenge is making it work without logging in

you can make a request to /get_video_info using the ANDROID client [4].

Doesn't work https://www.youtube.com/get_video_info?video_id=Cr381pDsSsA&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FCr381pDsSsA&html5=1&c=ANDROID&cver=16.20

pukkandan avatar Jul 14 '21 19:07 pukkandan

I have a strange feeling that all of get_video_info has been removed as I've seen it 404 on everything I've thrown it - age restricted or not. Some googling shows that a while back they added more required fields which could be a possiblity, but I'd say they probably just entirely removed this endpoint to stop people from bypassing age restriction for legal reasons.

SunburntRock89 avatar Jul 24 '21 21:07 SunburntRock89

I have a strange feeling that all of get_video_info has been removed as I've seen it 404 on everything I've thrown it

Seems like it. We also couldn't find a set of parameters that works. the embed-workaround still works for embeddable videos, but auth seems necessary for everything else now

pukkandan avatar Jul 25 '21 02:07 pukkandan

there seems to be a greasyfork script to fix this issue, so does this code help? https://greasyfork.org/en/scripts/375525-youtube-age-verification-bypass/code

D3V1LC0D3R avatar Jul 25 '21 15:07 D3V1LC0D3R

there seems to be a greasyfork script to fix this issue, so does this code help? https://greasyfork.org/en/scripts/375525-youtube-age-verification-bypass/code

This is what https://github.com/iv-org/invidious/pull/2205 did. That method no longer works

pukkandan avatar Jul 25 '21 17:07 pukkandan

the embed-workaround still works for embeddable videos

@pukkandan Could you point out which one is that?

reallyuniquename avatar Jul 25 '21 19:07 reallyuniquename

You need to re-request the /browse API with the WEB_EMBEDDED_PLAYER client instead of WEB (other clients that work: ANDROID_EMBEDDED_PLAYER, IOS_MESSAGES_EXTENSION). See related params here

This method can bypass embeddable videos like HtVdAasjOgU, but others like Tq92D6wQ1mg will still not work

https://github.com/iv-org/invidious/pull/2220 already implements most of what is needed for this

pukkandan avatar Jul 25 '21 19:07 pukkandan

There's a new bypass method: https://github.com/yt-dlp/yt-dlp/issues/574#issuecomment-887171136

All our findings so far: https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287

pukkandan avatar Jul 27 '21 06:07 pukkandan

Updated method created in PR https://github.com/iv-org/invidious/pull/2329, feel free to test it and submit your feedback.

unixfox avatar Aug 13 '21 22:08 unixfox

Reopening like https://github.com/iv-org/invidious/issues/2189#issuecomment-880080346

unixfox avatar Aug 16 '21 17:08 unixfox

I just stumbled across this issue. It worked in my build from 2022.01.21 and failed in the latest. After some testing, according to git disect commit 99091e919c9af56c27ca8aebd790c3b64b564f78 broke it again:

last good: 2022.02.03-6ddbccbc first bad: 2022.02.03-99091e91

sriegler avatar Feb 09 '22 00:02 sriegler

Message from @TheFrenchGhosty:

The age restriction bypass isn't working consistently, it will only properly work after ~5 requests (just refreshing the page on the instance works). When it works once, it will work consistently everytime (because of caching I'm guessing).

Screenshots

error

Additional context

I can provide some examples videos IDs at request.

On a related note: the age restricted videos, don't have descriptions.

unixfox avatar Feb 16 '22 16:02 unixfox

Youtube is rolling out some changes that breaks tier 3 age-gate bypass. There is currently no known workaround (other than passing the request through a proxy). yt-dlp and newpipe are also affected

pukkandan avatar Feb 16 '22 17:02 pukkandan