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

[YouTube] Fix buffering by decoding n parameter of stream urls #683

Merged
merged 13 commits into from
Jul 28, 2021

Conversation

XiangRongLin
Copy link
Collaborator

@XiangRongLin XiangRongLin commented Jul 15, 2021

  • I carefully read the contribution guidelines and agree to them.
  • I have tested the API against NewPipe.
  • I agree to create a pull request for NewPipe as soon as possible to make it compatible with the changed API. No compatibility changes

My attempt at fixing TeamNewPipe/NewPipe#6510 by applying the javascript function to decode n parameter as mentioned here TeamNewPipe/NewPipe#6510 (comment)
I think this implementation is correct, but I could not confirm it because just these changes are not enough to solve the problem. NewPipe itself needs to also apply the decoder on the urls while streaming.

Code is ugly, because I don't 100% know if it is working and did not want to put more time into it

@XiangRongLin
Copy link
Collaborator Author

I cleaned up the code and added some tests for it. Now it's just waiting to see if the problem still occurs with this change.

@XiangRongLin XiangRongLin marked this pull request as ready for review July 17, 2021 17:21
@XiangRongLin XiangRongLin marked this pull request as draft July 17, 2021 17:21
@XiangRongLin XiangRongLin marked this pull request as ready for review July 20, 2021 12:47
@XiangRongLin
Copy link
Collaborator Author

XiangRongLin commented Jul 20, 2021

Seeing how the before-clean-up version seems to be working fine for a few days now, I would mark this as ready for review, so we can get this issue fixed

@TobiGr

Copy link
Member

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I just pointed out small things.

Also address review and rewrite some comments
Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code generally looks very good.
However some minor questions / notes came up while reviewing.

Also tested it since >3 days in my experimental NewPipe branch and it works without (major) problems 😄

AudricV and others added 3 commits July 27, 2021 17:24
Use final where possible, annotate some methods and parameters as Nonnull and format new code to be in the 100 characters limit per line.
…lyStreams methods of YoutubeStreamExtractor

Without this commit, the n param is only decrypted for streams extracted in getVideoStreams (so only for streams in the formats object of the player response).
The decryption code changes over time. Only check whether the n parameter was changed in the URL
@TobiGr
Copy link
Member

TobiGr commented Jul 28, 2021

There are still failing tests, but they are not related to this PR.

@TobiGr TobiGr merged commit 394c02a into TeamNewPipe:dev Jul 28, 2021
@XiangRongLin XiangRongLin deleted the yt_throttling branch July 28, 2021 17:16
TobiGr added a commit that referenced this pull request Jul 28, 2021
[YouTube] Fix buffering by decoding n parameter of stream urls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug youtube service, https://www.youtube.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants