-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Improve youtube api calls #1985
Improve youtube api calls #1985
Conversation
05acacc
to
2a23501
Compare
Thank you for your work. Great improvements. That's the way to go in order to reduce the amount of reCAPTCHA and have a more stable way of fetching the data from YouTube. |
No probs ^^ I'm currently facing an issue, tho: the actual way of fetching video infos ( |
@SamantazFox Note also that there are two endpoints used for videos: |
Thanks! For now, I'm only interested in using the |
When I said additional stats, it's likes/dislikes for example and the next videos, which are part of the watch page of Invidious, even if they are not from a playlist. |
There's not rate limit according to my testing. (I tested 35k requests). You may be interested in using the mobile client name and version to remove the need for signature ciphers for the API. ( Another thing I noticed - Invidious has support for protobuf requests?! You can replicate the exact android app for even api stablity with that! |
Oh, okay, nice! Thanks for the clarification!
Nifty :D
What do you mean by "signature ciphers"?
Yes, thanks to Omar Roth's We could also randomize between the two, to reduce even more the risk of rate limiting. |
See https://github.com/iv-org/invidious/blob/master/src/invidious/helpers/signatures.cr. It's for the protected contents, especially music contents (YouTube Music tracks, videoclips, ...). |
Oooh, right! From my experience with invidious (about a year or so), reading of protected videos never worked. I guess that's yet another entire subject. Also, from my understanding, we will alway need those ciphers, as they're required to get the video stream from youtube, no matter wich API we use to get JSON: invidious/src/invidious/videos.cr Lines 578 to 589 in b7eba3b
|
Not really, see TeamNewPipe/NewPipeExtractor#562. |
Small update: I've been using this branch on my personnal instance for 3 weeks, and it works without issues. I'll try to continue working on that this week-end (I'm still having some server issues). |
Nice ;) |
What's left to be worked on here? In case I could help. |
The use of the new internal API for the videos in Invidious (see my issue for more details). |
A lot of scraping needs to be replaced by this as well but that may be a bit out of scope for this specific PR |
|
Do you have examples? |
|
@TiA4f8R ah, yeah, thanks ^^ |
Here's one. There's a lot of areas in Invidious that scrapes Youtube's page. |
I really appreciate, but say thank you to @FireMasterK. Without they, I would not have been able to find this. |
As the amount of API endpoint function grow, this will prevent ugly code copy/pasta
I thought I could do that easily, but the channel's routes code should be cleaned first. |
Oh come on.... It's just a useless comma.... |
4d54387
to
b7fe212
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
I'm a bit lost on this PR, is all the work already done? Like are we still parsing the HTML of the www.youtube.com webpage? |
No, there is still stuff to do. As explained here, there are some other things that need to be fixed/sorted out first. TL;DR: I don't properly understand the region bypass code, the channel community tab need to be fixed first, the channel routes need to be moved out of
|
Ok so we can keep this PR as a draft until we use the majority of the youtube mobile API? |
I'm not sure to understand what you mean by "use the majority of the YT mobile API"? |
Well I meant that until we don't stop scraping the HTML of the YouTube webpages for most of the logic in Invidious we can set this PR as a draft because like you said in #1985 (comment) there are still a lot of code that need to be converted to use the YouTube mobile API. |
Ah, ok. I'll see what I can do for the player, but this PR will need to be merged before I can do anything about the channel's "about" tab. The I'd prefer to not touch that atm, and make a separate PR that will clean the code, move it to Edit/Note: The code as-is is perfectly functional, and what could easily use those API endpoints now use them. I've been running those modifications on my instance for all that time this PR was open, until this weekend. |
PR live in testing on https://yewtu.be |
@unixfox How is it going? |
See #1981 and #1929 (comment) for previous discussions on the subject.
This PR is only a partial job, as some code cleaning and some other fixes are required before continuing. See #1985 (comment) and #1985 (comment) for further details.