Xonshiz / anime-dl

Anime-dl is a command-line program to download anime from CrunchyRoll and Funimation.
MIT License
229 stars 37 forks source link

Crunchyroll not working #74

Closed Nicnl closed 5 years ago

Nicnl commented 5 years ago

Crunchyroll is just... not working anymore.

No error thrown, it just fails and exit silently, no matter if the verbose mode is enabled.

Nicnl commented 5 years ago

It seems that they updated their links to add the language in the URL

For instance, going to the link on the README.MD: http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying/episode-13-happy-days-678059
redirects me to:
https://www.crunchyroll.com/fr/i-cant-understand-what-my-husband-is-saying/episode-13-happy-days-678059

Notice that they added /fr (or whatever accoding to your current language setting)

Nicnl commented 5 years ago

I updated the Crunchy_Video_regex regex, so that it enters the condition, but the resulting XML does not contains the <file> tag.

Nicnl commented 5 years ago

Okay, there's no video metadata whatsoever, just:
<upsell>1</upsell>

It seems that somehow, the login function isn't really doing it's job and we're actually not getting authenticated
(even though I'm getting 'Logged in successfully' in the logs)

Nicnl commented 5 years ago

Lol, okay, I found out why...

https://github.com/Xonshiz/anime-dl/blob/754a32d2ad0ce7a34d0bb13464e6fe20f8a5dee9/anime_dl/sites/crunchyroll.py#L59-L69

Nicnl commented 5 years ago

huh, it seems that they also changed the login url

Old: https://www.crunchyroll.com/login

New: https://www.crunchyroll.com/fr/login

I don't feel like hardcoding /fr everywhere
(It works though, I've just tried it)
I'm trying to extract the country name from the anime URL and reuse it in the login URL

Nicnl commented 5 years ago

Holy shit, my code is disgusting
But I just noticed the top comment, so... yeah, that'll do I guess

I'm sending a merge request

Abu3safeer commented 5 years ago

Thanks for your work, I am not python developer, so I will leave it to you!

Nicnl commented 5 years ago

Hey @Xonshiz

I created a pull request at #75 for the crunchyroll fix

I encountered weird issues, notably with the whole xml encode/decode/utf8 thing
Maybe my python version was different or something (I'm using 3.7)

Anyway, I guess you'll have to review the code, and package the .exe release.
It's in your hands!

Abu3safeer commented 5 years ago

I tried the app now, it works properly, all you need is to use the original url without language so if you find en or fr or whatever there, just remove it, it should work.

Nicnl commented 5 years ago

Yes and no

Even though as is the app says "Logged in successfully", it's not actually logged in
Hence you can't download anything that's still in the exclusive-for-premium-account-only time period

Abu3safeer commented 5 years ago

I will try it now.

Abu3safeer commented 5 years ago

File downloaded successfully!

General
Unique ID                   : 266273693695228487631709212547229560154 (0xC85272B0B8285D13C1EB99B071BA2D5A)
Complete name               : \Path-to-anime-dl\Output\Black Clover\Black Clover - 67 [1920x1080].mkv
Format                      : Matroska
Format version              : Version 4
File size                   : 1.11 GiB
Duration                    : 23 min 55 s
Overall bit rate            : 6 667 kb/s
Encoded date                : UTC 2019-01-22 22:00:14
Writing application         : mkvmerge v30.1.0 ('Forever And More') 64-bit
Writing library             : libebml v1.3.6 + libmatroska v1.4.9

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L4
Format settings             : CABAC / 4 Ref Frames
Format settings, CABAC      : Yes
Format settings, ReFrames   : 4 frames
Codec ID                    : V_MPEG4/ISO/AVC
Duration                    : 23 min 53 s
Bit rate                    : 6 544 kb/s
Width                       : 1 920 pixels
Height                      : 1 080 pixels
Display aspect ratio        : 16:9
Frame rate mode             : Constant
Frame rate                  : 23.976 (24000/1001) FPS
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.132
Stream size                 : 1.09 GiB (98%)
Writing library             : x264 core 142
Encoding settings           : cabac=1 / ref=4 / deblock=1:1:1 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=0.40:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=48 / keyint_min=25 / scenecut=0 / intra_refresh=0 / rc_lookahead=48 / rc=crf / mbtree=1 / crf=15.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=8000 / vbv_bufsize=12000 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:0.60
Default                     : Yes
Forced                      : No

Audio
ID                          : 2
Format                      : AAC LC
Format/Info                 : Advanced Audio Codec Low Complexity
Codec ID                    : A_AAC-2
Duration                    : 23 min 53 s
Bit rate                    : 128 kb/s
Channel(s)                  : 2 channels
Channel layout              : L R
Sampling rate               : 44.1 kHz
Frame rate                  : 43.066 FPS (1024 SPF)
Compression mode            : Lossy
Delay relative to video     : -83 ms
Stream size                 : 21.9 MiB (2%)
Default                     : Yes
Forced                      : No

Text #1
ID                          : 3
Format                      : ASS
Codec ID                    : S_TEXT/ASS
Codec ID/Info               : Advanced Sub Station Alpha
Duration                    : 23 min 47 s
Bit rate                    : 136 b/s
Count of elements           : 361
Compression mode            : Lossless
Stream size                 : 23.8 KiB (0%)
Title                       : English(US)
Language                    : English
Default                     : Yes
Forced                      : No

Text #2
ID                          : 4
Format                      : ASS
Codec ID                    : S_TEXT/ASS
Codec ID/Info               : Advanced Sub Station Alpha
Duration                    : 23 min 47 s
Bit rate                    : 166 b/s
Count of elements           : 362
Compression mode            : Lossless
Stream size                 : 29.0 KiB (0%)
Title                       : Arabic
Language                    : Arabic
Default                     : No
Forced                      : No

Text #3
ID                          : 5
Format                      : ASS
Codec ID                    : S_TEXT/ASS
Codec ID/Info               : Advanced Sub Station Alpha
Duration                    : 23 min 47 s
Bit rate                    : 145 b/s
Count of elements           : 385
Compression mode            : Lossless
Stream size                 : 25.3 KiB (0%)
Title                       : Deutsch
Language                    : German
Default                     : No
Forced                      : No

Text #4
ID                          : 6
Format                      : ASS
Codec ID                    : S_TEXT/ASS
Codec ID/Info               : Advanced Sub Station Alpha
Duration                    : 23 min 49 s
Bit rate                    : 109 b/s
Count of elements           : 323
Compression mode            : Lossless
Stream size                 : 19.2 KiB (0%)
Title                       : Espanol(Espana)
Language                    : Spanish
Default                     : No
Forced                      : No

Text #5
ID                          : 7
Format                      : ASS
Codec ID                    : S_TEXT/ASS
Codec ID/Info               : Advanced Sub Station Alpha
Duration                    : 23 min 49 s
Bit rate                    : 109 b/s
Count of elements           : 324
Compression mode            : Lossless
Stream size                 : 19.2 KiB (0%)
Title                       : Espanol
Language                    : Spanish
Default                     : No
Forced                      : No

Text #6
ID                          : 8
Format                      : ASS
Codec ID                    : S_TEXT/ASS
Codec ID/Info               : Advanced Sub Station Alpha
Duration                    : 23 min 47 s
Bit rate                    : 132 b/s
Count of elements           : 325
Compression mode            : Lossless
Stream size                 : 23.1 KiB (0%)
Title                       : Francais(France)
Language                    : French
Default                     : No
Forced                      : No

Text #7
ID                          : 9
Format                      : ASS
Codec ID                    : S_TEXT/ASS
Codec ID/Info               : Advanced Sub Station Alpha
Duration                    : 23 min 47 s
Bit rate                    : 142 b/s
Count of elements           : 358
Compression mode            : Lossless
Stream size                 : 24.9 KiB (0%)
Title                       : Italiano
Language                    : Italian
Default                     : No
Forced                      : No

Text #8
ID                          : 10
Format                      : ASS
Codec ID                    : S_TEXT/ASS
Codec ID/Info               : Advanced Sub Station Alpha
Duration                    : 23 min 47 s
Bit rate                    : 145 b/s
Count of elements           : 359
Compression mode            : Lossless
Stream size                 : 25.3 KiB (0%)
Title                       : Portugues(Brasil)
Language                    : Portuguese
Default                     : No
Forced                      : No

Text #9
ID                          : 11
Format                      : ASS
Codec ID                    : S_TEXT/ASS
Codec ID/Info               : Advanced Sub Station Alpha
Duration                    : 23 min 48 s
Bit rate                    : 228 b/s
Count of elements           : 389
Compression mode            : Lossless
Stream size                 : 39.8 KiB (0%)
Title                       : und
Default                     : No
Forced                      : No
Nicnl commented 5 years ago

Weird... I just tried again using the latest version

C:\anime-dl>anime-dl.exe -u •••••••• -p •••••••• -r 1080 -i https://www.crunchyroll.com/black-clover/episode-67-a-fun-festival-double-date-780895
Trying to login...
Logged in successfully...
Seems like this video isn't available...
'NoneType' object has no attribute 'group'
Abu3safeer commented 5 years ago

Is this show available in your country?

Nicnl commented 5 years ago

Yep, I can watch it directly on the website without any issues in my native language

Abu3safeer commented 5 years ago

try wrapping data inside double quotation mark, like this:

anime-dl.exe -u "••••••••" -p "••••••••" -r "108"0 -i "https://www.crunchyroll.com/black-clover/episode-67-a-fun-festival-double-date-780895"
Abu3safeer commented 5 years ago

I know it might sound stupid, but sometimes small details may cause big problems. I am not saying language /en/ in the link does not cause any problems, but for now until @Xonshiz response, you can omit it from the link, since it work for me, this should work for you.

PS: I am using my tool anime-dl-gui to download, you might consider trying it.

Nicnl commented 5 years ago

No changes whatsoever.
With or without quotes, with or without manually removing the country in the URL, etc...
I still have the same result:

Seems like this video isn't available...
'NoneType' object has no attribute 'group'

I checked and double checked; The video is definitely 100% available in my country
The only way for me to download it was to use the patched version I wrote

After tinkering with the login function a bit, I'm 100% sure about what I'm going to say:
The root cause of the error is that the session is not properly authenticated
Hence accessing a premium only video is prohibited
(Remember I'm getting <upsell>1</upsell> in the xml)
That also means that using the link of a free episode (in this case the 66th one) works

My assumption is that Crunchyroll handles authentication (or redirection?) differently according to the country.
Anyway, we'll see.

Abu3safeer commented 5 years ago

My assumption is that Crunchyroll handles authentication (or redirection?) differently according to the country.

So It is all about the login, I wish I understand python to test it myself. Thank you for your contribution.

Thedarklife74 commented 5 years ago

any news for update ? Not able to make work with de purposed patch

Xonshiz commented 5 years ago

Hey, I'm a little too busy with office work and haven't been able to get anything done. I'll try to look at it this weekend and try to follow up.

Nicnl commented 5 years ago

I have removed the previous pull request, and replaced it by #76.

It turns out that I was using Python 3.7, and I had to do weird encode/decode things to get 3.7 to work. I proceeded to switch to 2.7, removed the weird encode/decode things, and sent the #76 pull request that only contains the fix for Crunchyroll's changed URLs and nothing else.

I also have in hand the packaged anime-dl.exe ready to use, thanks to @Xonshiz's exeMaker.bat script.
If someone is really in a hurry, I guess I can send it,
but otherwise I really don't like the idea of strangers downloading and running other stranger's exe files on their computers.

Thedarklife74 commented 5 years ago

@Nicnl I'm intresting to test your solution

Nicnl commented 5 years ago

Let me know if it works well on your side or not

anime-dl.exe
MD5: 301336b5cc7a866ba595cb4231ecb245
SHA145: 0a142aa85660c64e0b0fa98a4751e11621836c6a29d17e1d78ebd3262dc4beaa

Thedarklife74 commented 5 years ago

@Nicnl It work perfectly

Abu3safeer commented 5 years ago

I can confirm, it works properly, thank you @Nicnl