-
Notifications
You must be signed in to change notification settings - Fork 112
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
Fix throttled streaming by using a new route #215
Conversation
- Use a different API request to get stream data. - Remove code deciphering the `n` and `signature` parameters.
- Add MIME type for all video items and turn off Kodi's content lookup so that it doesn't make the additional MIME type requests with its internal "Kodi" User-Agent.
In case this route is ever blocked and you're back to having to deal with There's more info about those in here:
If you don't use those parameters you get throttling. I think the only robust way to handle these, if ever needed, is to make a dummy HTTP server in localhost and tell Kodi to stream the file through it. Then you take Kodi's chunk requests and translate them to these YouTube parameters, stream the data and pass it back to Kodi. So while Kodi is playing the video this custom server handled by the plugin is being a middleman. Edit: or making a fork of |
@RNavega Does this return an mpd url, or just urls that are currently unaffected? |
@RNavega |
Thank you for the fixes and cleanup!
If I understood you right, it gives the same kind of
As you noticed, that was being caused by that last change I made, restoring the "Authorization" header. It looks like the API request fails with a HTTP 400 "Bad Request" error if you do that, I don't know why. But thankfully you fixed that by removing the lines that added this header when the user is logged in. The problem is that if we can't use this login token, then age-gated or restricted videos won't be watchable. I don't think I'll be able to fix this because I can't debug it. Edit: some more info in these:
|
@RNavega Thanks for the patch! I'll test it later today on libreelec ( Pi 3 B+ ) Regarding age-gated videos not working, please see this comment: |
I installed the certificate as a root (through Magisk's systemless hosts module) one and used |
@tssajo ok, before you test this PR please note that it added a bug. Thanks for that pointer on the age gating. When I tested other client names, as Unixfox pointed out in that thread, any client name other than just "ANDROID" will give out streams protected by the
@FireMasterK Thank you, that makes sense. |
Edit: For anyone dropping by, this PR had a bug.
If you want to grab the files for testing, you should take the ones from anxdpanic's fix in this later PR: https://github.com/anxdpanic/plugin.video.youtube/pull/216/files
Original text below:
Special thanks to @tssajo for pointing this solution out, and to @FireMasterK for publishing it in the first place.
This PR adds a specific API request that gets the
ytInitialPlayerResponse
data and it comes with all the streams without then
parameter and without the need to decipher the signature parameter. So thatn
calculation and signature deciphering code can be removed.This PR also changes some header usage so that all video items use a User-Agent spoofing an Android device (otherwise Kodi sends out a MIME type request with Kodi's own User-Agent, making it obvious it's coming from a Kodi plugin).
Some testing needs to be done with age-restricted videos to see how / if they still work under these new changes, but logged-out playing is working again without throttling at least.