rustube
rustube copied to clipboard
Could not acquire the player response (age-restricted videos)
Edit
The issue was partially fixed. For now only age-restricted or otherwise unavailable videos should fail to download. If you encounter this problem with a 'normal' video, please let us know about it.
Old issue:
Apparently, YouTube keeps removing the /get_video_info
endpoint. pytube
(#1060) has the same issue.
We have logs and backtraces of two failed actions:
I guess it gets more and more clear, that we have to find a way to make the youtube-api-v1 work since /get_video_info
will probably not be around for much longer.
Could anyone recommend a tool for JS reverse engineering? This would help me to find out how youtube.com
handles the video download.
From what I know, youtube uses blob URLs. You could try to see how https://github.com/ytdl-org/youtube-dl do it, because it works flawlessly.
@aviallon welcome to rustube
. Your tip was great! I usually avoid youtube-dl
, since the code base is just massive and messy. They actually just make one step less than we do, and this step broke.
For now, I fixed downloads of normal videos. Age-restricted videos don't work yet. I won't have time to look into that right now and will work on that later.
Working quick fix: v0.3.5
If you mean age-restricted videos, then VXDsM-1McE0
and irauhITDrsE
are two examples from our tests.
For other examples of private, ... videos, you can always checkout (or expand) tests/common.rs.
@89z Thank you, that looks really promising!
One question regarding the Bearer token: When I understood the code correctly the auth token is acquired in func (o OAuth) Exchange() (*Exchange, error)
, using the hardcoded clientID
and the hardcoded clientSecret
.
Then, in oauth_test.go
it says Sign in to your Google Account. Is this login request unrelated, or would the OAuth solution require the user to log in to his account?
@DzenanJupic, it appears you deeply misunderstand the nature of YouTube restrictions. You have three levels of video. You have "level 1" videos, with no restriction:
_Vyye4wNvoY
You have "level 2" videos, which can be accessed with "embed" workaround:
q4qWMcQfOCc
and you have "level 3" videos, which must use authentication:
irauhITDrsE
Again, for "level 3" videos, you must use authentication. This means either OAuth or cookies. No "hack" or "workaround" is available.
We actually had a workaround for age-restricted videos using the /get_video_info
endpoint. (you can have a look at past commits and daily actions)
Unfortunately, YouTube is slowly but steadily drifting away from this endpoint and towards API v1. In a best-case scenario, we would find another way of accessing age-restricted videos without requiring the user to log in. Especially, since this adds a whole new layer of complexity.
Based on your answer I guess the answer to my previous question is: Yes, the user has to log in to download age-restricted videos using the OAuth solution.
We actually had a workaround for age-restricted videos using the
/get_video_info
endpoint. (you can have a look at past commits and daily actions)
I will say again, currently, it is only possible to access "level 3" videos with authentication. If you have evidence otherwise, please share it, but I am confident in my statement here.
Regarding authentication, I think OAuth is the best option, because you just have to log in one time, then you can save the access_token
locally for reuse.
I did not state, that it's possible right now. That's the reason this issue exists since a recent API-change four days ago broke our code.
But before that, we were able to download i.e. irauhITDrsE
, which you stated to be level 3. (this action has a log to prove it)
Edit: I should add that this is not the first time this part of the code broke, so I still have hope there's a workaround.
Regarding authentication, I think OAuth is the best option because you just have to log in one time, then you can save the access_token locally for reuse.
That actually sounds better than I expected, I will definitely try to implement it.
That actually sounds better than I expected, I will definitely try to implement it.
If you want to see the code in action, I also have a command line tool here:
https://github.com/89z/mech/tree/master/cmd/youtube
First perform the one time login process:
youtube -x
Then download a video with authentication:
youtube -c irauhITDrsE