-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
[WIP] [Funimation] Fixes for language matching and playlist handling to pull full shows #13515
Conversation
Forgive my stupidity, but how do you specify the language here? None of the parameters on |
@josegonzalez Funimation episodes, when accessed in the browser, use the lang querystring to select the language you want, so I'm using the same method. The regex looks for an optional pattern along the lines of It would be nice if there were an option, maybe an extension of -f, that allowed language selection to be passed to the extractor. There's a format_id add on for -f that I saw mentioned in #8891 but I've no idea how or if that actually works with the extractors. To my mind, the format supported by the upstream site should probably win out over options though, if following the principle of least surprise. |
Read and fix all issues. |
I was messing around with this fork and found something interesting when using my account. Downloading the webpage with youtube-dl shows the KANE_customdimentions as a new customerType;
However when using cookies gathered from chrome I am getting:
This helps with getting the correct formats. |
@btaidm are you using netrc to login from youtube-dl? |
@kaithar I am passing login info from the command line. I can try using netrc to see if that would work without passing the cookie file. |
Hi guys sorry to post here but I really didn't know where else to go I'm a self Internet taught Linux user and finally managed to get funimation working with youtube-dl now as you may have guessed I have no idea how to pass the argument to youtube-dl to grab the English language dub and by default it seems to only grab Japanese I see the links are appended with /a=1 for English so I assumed that would grab the English dub but it doesn't I've read around and to be totally honest I'm lost on what to do or if it's even been implemented yet since I see it's a work in progress I've tried adding lang=english too but to no avail Any help for a novice user would be greatly appreciated thank you |
@jackalblood This is probably not the best place to discuss this, but by browsing the code, it appears you need to add
|
I think adding something to the URL is a really poor way of selecting formats based on language (especially if the site itself does not do this). |
I'm guessing option 3 is my issue currently since I can verify 1 and 2 I'll look into how to change my current fork since I'm using a pip install just one of them things I just didn't think of thanks very much for the information I won't take up any more of your time thank you again |
@jackalblood cd /path/to/cloned/repo
python -m youtube_dl args... or PYTHONPATH=/path/to/clone/repo python -m youtube_dl args... |
@kaithar |
@btaidm that definitely got me working with the correct fork now but the problem is still persisting I've uninstall all other versions just to be sure and with or without the ?lang=english I'm getting Japanese so either I'm missing something or it's just not working out for me |
@jackalblood For chrome, I use the cookies.txt extension. Then pass the cookie as an argument to youtube-dl python -m youtube_dl --cookie /path/to/cookie.txt args... |
@btaidm I didn't even realise I could do that I'll give it a go as soon as I'm home thank you will the cookies allow me to pull a certain language then? |
@btaidm That was the solution! Thank you very much for taking the time to walk me through it all it was really very simple if you know how So I can absolutely confirm this fork will get English-speaking audio if you pass your cookies |
@jackalblood Here is an example command that I have used: python -m youtube_dl -n --cookie ~/Downloads/cookies.txt https://www.funimation.com/shows/one-piece/the-beginning-of-the-new-chapter-the-straw-hats-reunited/uncut/\?lang\=english argument explanation:
With this fork, it will first try to use the uncut dub, then fall back to the simulcast, then Japanese, I believe. |
@jackalblood |
@mariuszskon Honestly I agree, the way the language selection is done on funimation is a headache. The website is horribly unreliable in this regard. The android app is actually even worse, I've had issues where I've been casting it to my TV and getting Japanese audio even though the app has English selected. I've been toying with the idea of either adding support for a |
Ok, hopefully that will solve the language issues in a more consistent way. I've made it so that if the first experience it requests has a suitable alpha with empty sources then it will request that languages experience and redo the search before falling back further. This fixes this flow:
Steps 4 and 5 are new... it might result in requesting the experience file twice in some situations, but mostly it should give a more consistent success in finding the right language. I've also added the language and language_preference keys to the format return. I've not played with the format selection to see if that's useful, but the information is there at least. I could make it so that the extractor returns all the alphas rather than selecting what it thinks is the best match, but I have a feeling that that would actually be counter productive and would also result in making even more requests for experience files. |
As noted on #14089 it seems that they made some changes to the site. I think I've got a working fix figured out but I still need to give it a little work out and remove some localisations. |
I think their site changes have settled down again now. I'll see about cleaning up code and pushing it to this PR branch. |
Well, I spoke too soon... they added/turned on incapsula anti-bot nonsense ¬_¬ |
@kaithar |
@compguy284 you did? I wasn't having much luck with that, what user agent did you use? |
@kaithar If you don't specify one for incapsula-cracker-py3 then it uses something else by default. |
@compguy284 hmmm, that's odd, I was using The bypass I've finally managed to get working has involved writing a reverse proxy that sanitises the headers for every request and then using a hosts file override to send the requests through it. |
Wow... that is frustrating. Any luck in figuring out a workaround? |
It looks like they've stopped making major changes to the site and the code I have has been working reliably. I'll need to try disabling my proxy solution... it's worked for a suspiciously long amount of time for a bot detection method. I also need to clean up the code and rebase it against master. |
hi Unable to extract al:web:url |
Super simple fix for incapsula if you're not actually running a botnet or something idk
|
It doesn't work for me. |
Before submitting a pull request make sure you have:
In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:
What is the purpose of your pull request?
Description of your pull request and other information
First off, I've skimmed the docs, but I've not actually checked if I'm following them. This is a WIP I'm submitting so that others can test it and suggest errors. I'm also not certain it'll pass tests, if it doesn't I'll fix. That said, I've been using and testing this code for a while now, and I think I've ironed out all the bugs and corner cases, so it does work even if it's not the most polished PR. I've also left in some debug and informational print statements. These should probably be converted to something more in keeping with the style guidelines but I'm not familiar enough with the overall code base to know what.
Second, there is some overlap between this PR and #9515 ... I'm not sure how much but I've definitely produced a competing show playlist solution. I doubt both will merge and it looks long abandoned, but I'd like to look at picking up some of the changes from that PR in this one if that's ok.
So, disclaimers done, on to what this pull is aiming at doing. As mentioned in #13225 I've been fixing some issues with the Funimation extractor.
Firstly, I've implemented a full show playlist extractor. I've made some assumptions in it, but I think they're fair. Specifically:
Secondly, I've given the actual episode extractor an overhaul. It appears Funimation aren't too picky about what language they initially offer you, and they're entirely consistent, so I've had to build code to attempt to work out the best option.
The logic is that it pulls out the simulcast or uncut value from the url, the language choice if one is given, then tries to find a source that matches both those values and the episode the url loads. Failing that it first tries the desired language with each of
'uncut', 'simulcast', 'extras'
, then it repeats the desired alpha and those 3 fall backs for English then Japanese. It accepts the first combination it finds a valid source entry for, since there are cases of episodes where those combinations are available but list no sources.Points 1 and 2 for the playlist extractor are also valid for the episode extractor.
There are some oddities in the episode numbering, but unfortunately those seem to be related more to the numbering on the site than the extractor code.
There are some features I want to add yet, adding language to the info dict is top of my list, but it seems ready for review and someone asked me to post it.