Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not acquire the player response (age-restricted videos) #38

Open
DzenanJupic opened this issue Jul 22, 2021 · 10 comments
Open

Could not acquire the player response (age-restricted videos) #38

DzenanJupic opened this issue Jul 22, 2021 · 10 comments
Labels
youtube-api-changed YouTube changed thier API and rustube needs to adjust to it

Comments

@DzenanJupic
Copy link
Owner

DzenanJupic commented Jul 22, 2021

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.

@DzenanJupic DzenanJupic added the youtube-api-changed YouTube changed thier API and rustube needs to adjust to it label Jul 22, 2021
@aviallon
Copy link

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.

DzenanJupic added a commit that referenced this issue Jul 23, 2021
…38

This is just to fix the video download. Since we get a PlayerResponse in watch_html anyway, there's no need to get the video_info from other sources. This works for now. The long term solution is to adapt to YouTube's API v1 (tracking issue: #39).
@DzenanJupic
Copy link
Owner Author

@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

@DzenanJupic DzenanJupic changed the title 404 /get_video_info not found Could not acquire the player response (age-restricted videos) Jul 23, 2021
@DzenanJupic
Copy link
Owner Author

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.

@DzenanJupic
Copy link
Owner Author

@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
Copy link
Owner Author

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.

@DzenanJupic
Copy link
Owner Author

DzenanJupic commented Jul 24, 2021

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.

@DzenanJupic
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
youtube-api-changed YouTube changed thier API and rustube needs to adjust to it
Projects
None yet
Development

No branches or pull requests

3 participants
@aviallon @DzenanJupic and others