Skip to content

Faster iframe api based player extraction.#694

Merged
XiangRongLin merged 5 commits intoTeamNewPipe:devfrom
FireMasterK:iframe-player-hash
Aug 7, 2021
Merged

Faster iframe api based player extraction.#694
XiangRongLin merged 5 commits intoTeamNewPipe:devfrom
FireMasterK:iframe-player-hash

Conversation

@FireMasterK
Copy link
Copy Markdown
Member

Uses the IFrame API to reduce the required download to less than 1/50 of the size.

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

Closes #693?

@AudricV AudricV added enhancement New feature or request YouTube Service, https://www.youtube.com/ labels Jul 30, 2021
Copy link
Copy Markdown
Collaborator

@XiangRongLin XiangRongLin left a comment

Choose a reason for hiding this comment

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

Do you have some examples to back up the 1/50 size claim?

@FireMasterK
Copy link
Copy Markdown
Member Author

Do you have some examples to back up the 1/50 size claim?

Yes, I do, in fact, it's a bit more than that:
image
image

Copy link
Copy Markdown
Collaborator

@XiangRongLin XiangRongLin left a comment

Choose a reason for hiding this comment

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

Can you think of a way to somehow automatically test if your new implementation is actually used and it does not just always go to the catch block with the old implementation?

I can't think of anything right away, besides making everything public.

Edit: Reasoning being that the current tests either only cover your new implementation or the old one and not both

@FireMasterK
Copy link
Copy Markdown
Member Author

FireMasterK commented Aug 2, 2021

What would you like to happen if the new implementation fails?

Printing an error?

I could move them over to two methods so that they can be individually tested.

@XiangRongLin
Copy link
Copy Markdown
Collaborator

What would you like to happen if the new implementation fails?

Printing an error?

Normally i would say log it, but because there is no logging setup => do nothing

I could move them over to two methods so that they can be individually tested.

Yeah that's probably the easiest thing

@FireMasterK
Copy link
Copy Markdown
Member Author

FireMasterK commented Aug 3, 2021

Done! Another thing I noticed is that the current tests do not account for the fact that the playerCode can be cached, thereby making some tests pointless.

@XiangRongLin
Copy link
Copy Markdown
Collaborator

Can you also add tests for the 2 methods

Another thing I noticed is that the current tests do not account for the fact that the playerCode can be cached, thereby making some tests pointless.

You can create an issue for it. I have a rough idea on how to solve it, but finding the time to do it may prove hard

@FireMasterK
Copy link
Copy Markdown
Member Author

Done!

Copy link
Copy Markdown
Collaborator

@XiangRongLin XiangRongLin left a comment

Choose a reason for hiding this comment

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

Good enough, since i can't think of anything else either. As in better tests/rewriting for better testability

@XiangRongLin XiangRongLin merged commit 71b9fd0 into TeamNewPipe:dev Aug 7, 2021
@FireMasterK FireMasterK deleted the iframe-player-hash branch August 7, 2021 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request YouTube Service, https://www.youtube.com/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make YoutubeJavaScriptExtractor more robust

3 participants