-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Made it possible to choose which client to use when sending innertube requests and define new clients #132
Conversation
This reverts commit fe0a538. Working example
… as specified by the request.
…use ANDROID_TV stopped working altogether.
src/main/java/com/github/kiulian/downloader/parser/ParserImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/kiulian/downloader/parser/ParserImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/kiulian/downloader/parser/ParserImpl.java
Outdated
Show resolved
Hide resolved
@iexavl what do you think about removing |
Yeah that's fine. Initially I thought the downloader could potentially use some information about the clients, but later I scrapped that, because realistically the only thing the downloader cares about is the client body. I'll add some more clients at some point and maybe write some documentation on what these clients actually are, because even if a client breaks if it's not written anywhere that it could potentially work if the user switches clients, there are possibly gonna be a decent bit of open issues about that. |
@iexavl ping me when its ready to be merged |
@sealedtx It's pretty much functionally ready. I added all the clients that were in the list and made default priorities for them. The priorities were determined by sending 5 requests with every client and checking how many of these requests were successful and how much time the request took. Of course, this is not super accurate because of the small data set, but I think it's enough for now. I have manually set the default client to ANDROID_VR, because all requests sent with it were a success, it was pretty fast and it has the biggest quality range out of the fastest ones. Here are the test results if you are interested: |
@iexavl is it difficult to run this test again? I'd like to see also list of available itags (quality formats) for each of client |
byAudioQuality.txt Seems I was wrong about ANDROID_TV. I ran the tests multiple times and TV_UNPLUGGED_CAST always came out on top. fullResults.txt : these are just the full test results. Not sorted in any particular order The cumulativeAV, video and audio qualities are sorted solely by their quality values, reliability and speed aren't included there. So there are some unregistered Itags, possibly for the ultrahighres. For now I am going to bed, but maybe tomorrow I will check what these itags are and add them to the Itag enum. |
@iexavl greatly appreciate your work! Can you share results in format?
also would be good to add definitions for unknown itags |
I added the missing Itags. Well, the ones that were reported to me anyway. The results are formatted exactly as you specified |
@iexavl seems like WEB needs to be top priority? |
Nope. I took a playlist and ran the test for longer. The good news is that the po_token works and I don't get flagged. Aside from the fact that this took like 40 minutes to run, the bad news is that pretty much all the WEB clients are almost completely busted. They all give this error: many times over. I think last time I might have landed on some videos that seemed to work, but with the playlist the problem showed. I had noticed this error in the WEB clients before and was surprised that I wasn't seeing it anymore, well I was wrong. |
@sealedtx is there a reason why the jsUrl needs to be extracted from the html response? I looked at the requests youtube was sending and I saw a constant js address. I changed the parseFormats call in parseVideoAndroid to this: and it looks like it's working. With that when there's a cipher it doesn't give those errors, and the web clients seem to be working fine. |
I can't remember exactly, I believe it is updated from time to time. You can try make default value for jsUrl if it fails to find one, thats would be ok Please, do this change, run final test and get the top 1 priority client, finalize the code and I'll merge it |
I have changed the ordering according to the latest test results, which are these: I still set the default client to ANDROID_VR. The main reason for that is because it doesn't require a cipher unlike pretty much all of the WEB clients. Also, the youtubei player requests never returns a jsUrl at least in my experience. It has to be obtained from the html page |
src/main/java/com/github/kiulian/downloader/parser/ParserImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/kiulian/downloader/parser/ParserImpl.java
Outdated
Show resolved
Hide resolved
String jsUrl; | ||
try { | ||
jsUrl = extractor.extractJsUrlFromConfig(playerConfig, videoId); | ||
} catch (YoutubeException ex) { |
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.
why do we need here another catch? it will just trigger callback.onError(ex);
twice with same exception
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.
@iexavl what about this? seems like unnecessary call callback.onError(ex);
@iexavl left comments to fix |
@iexavl I'll merge this as it it, if you don't respond until tomorrow, Will fix error callback myself. Thank you very much for your efforts |
I suppose I'll look forward to it. I am just not sure what you mean so its probably for the best that you do it. Feel free to merge whenever. |
At present because youtube is seemingly making some changes to it's APIS, requests made to certain clients might fail.
That's why, in case a request fails, with this one can choose to opt for a different client if the current one is broken. This can either be a registered client in
Clients
, or a custom made one if it has not been added yet to the registered ones. Any methods that use innertube have been updated to use clients specified in the corresponding request. At present, those include requests for video info, search continuation, and one for playlists. Using one of the registered clients is as simple as: