iv-org / invidious

Invidious is an alternative front-end to YouTube
https://invidious.io
GNU Affero General Public License v3.0
16.3k stars 1.81k forks source link

[Bug] Age Restricted Videos do not play #2189

Open SimoonDude opened 3 years ago

SimoonDude commented 3 years ago

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

Mennaruuk commented 3 years ago

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.

unixfox commented 3 years ago

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

Mennaruuk commented 3 years ago

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

TheFrenchGhosty commented 3 years ago

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 commented 3 years ago

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

pukkandan commented 3 years ago

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

syeopite commented 3 years ago

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

pukkandan commented 3 years ago

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

syeopite commented 3 years ago

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

pukkandan commented 3 years ago

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?

syeopite commented 3 years ago

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)
neurodiverseEsoteric commented 3 years ago

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

unixfox commented 3 years ago

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.

neurodiverseEsoteric commented 3 years ago

Oh ok, nevermind then....

unixfox commented 3 years ago

Reopening as not every age restricted videos are unblocked.

unixfox commented 3 years ago

@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.

syeopite commented 3 years ago

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

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

pukkandan commented 3 years ago

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

SunburntRock89 commented 3 years ago

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.

pukkandan commented 3 years ago

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

D3V1LC0D3R commented 3 years ago

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

pukkandan commented 3 years ago

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

reallyuniquename commented 3 years ago

the embed-workaround still works for embeddable videos

@pukkandan Could you point out which one is that?

pukkandan commented 3 years ago

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 commented 3 years ago

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

unixfox commented 3 years ago

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

unixfox commented 3 years ago

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

sriegler commented 2 years ago

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

unixfox commented 2 years ago

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.

pukkandan commented 2 years ago

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

girst commented 2 years ago

@pukkandan: is there a yt-dlp or newpipe issue i can follow for this?

unixfox commented 2 years ago

New method for bypass: https://github.com/yt-dlp/yt-dlp/pull/3233

unixfox commented 2 years ago

New method submitted in https://github.com/iv-org/invidious/pull/2996 Integrated on https://yewtu.be

TheFrenchGhosty commented 2 years ago

Here's 4 SFW videos that are age restricted, for testing purpose:

https://youtube.com/watch?v=FISUqoODw9Q https://youtube.com/watch?v=KVjHwrKJg8k https://youtube.com/watch?v=h16HA4XjyD8 https://youtube.com/watch?v=FISUqoODw9Q

4 SFW-ish more, from another channel:

https://youtube.com/watch?v=eJZqlQ3xvAo https://youtube.com/watch?v=VTxPsfQ4KL4 https://youtube.com/watch?v=Ufm3nYuHdhc https://youtube.com/watch?v=7lz8RpDtrGw

girst commented 2 years ago

On Tue, Mar 29, 2022 at 01:00:24PM -0700, TheFrenchGhosty wrote:

Here's 4 SFW videos that are age restricted, for testing purpose:

there's a 4-tiered list of videos that's used to check agegate bypasses: https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-888837000

unixfox commented 2 years ago

On Tue, Mar 29, 2022 at 01:00:24PM -0700, TheFrenchGhosty wrote:

Here's 4 SFW videos that are age restricted, for testing purpose:

there's a 4-tiered list of videos that's used to check agegate bypasses: https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-888837000

Tiers 1,2 and 3 seems to work with the new method, which is great.

tuxayo commented 2 years ago

Should this ticket be closed now that #2996 has been merged? Or is there still an issue?

unixfox commented 2 years ago

Should this ticket be closed now that #2996 has been merged? Or is there still an issue?

No because not all age restricted videos can be bypassed so this issue is not entirely fixed.

pukkandan commented 2 years ago

tbh, It is doubtful this can ever can be fully fixed unless setting up an account proxy server is an acceptable option

unixfox commented 2 years ago

tbh, It is doubtful this can ever can be fully fixed unless setting up an account proxy server is an acceptable option

We have been talking about integrating that into invidious so it may come one day.

unixfox commented 2 years ago

Note: encrypted age-restricted videos don't work, see: https://github.com/iv-org/invidious/issues/3245

Example video IDs:

SamantazFox commented 1 year ago

Non-working video ID, reported to me by e-mail: A2W2EBMX8DY

UlyssesZh commented 12 months ago

For me, I still have issues watching age restricted videos. Loading them are significantly more slowly (which greatly influences watching) than loading other videos. I can observe this for all videos listed in this comment.

unixfox commented 12 months ago

For me, I still have issues watching age restricted videos. Loading them are significantly more slowly (which greatly influences watching) than loading other videos. I can observe this for all videos listed in this comment.

Known issue, it's tracked in https://github.com/iv-org/invidious/issues/3245