[Crunchyroll] Log In support
See original GitHub issueChecklist
- I’m reporting a site feature request
- I’ve verified that I’m running yt-dlp version 2021.10.22. (update instructions)
- I’ve checked that all provided URLs are alive and playable in a browser
- I’ve searched the bugtracker for similar issues including closed ones. DO NOT post duplicates
- I’ve read the guidelines for opening an issue
- I’ve read about sharing account credentials and I’m willing to share it if required
Region
No response
Example URLs
https://beta.crunchyroll.com/it/watch/G8WUN2ND8/La-citt-delle-bestie-magiche-coperta-di-neve https://beta.crunchyroll.com/watch/GJWU2J7Z8/Clash-Class-A-vs-Class-B
Description
Like I said the in site support issue https://github.com/yt-dlp/yt-dlp/issues/915
It is possible to not only support the website but also the login for crunchyroll. Access to beta crunchyroll should be default in US for free and paid account (so you should be able to test this with a free account). Like I said in the support site issue we already got two example on how to implement the log in support https://github.com/hyugogirubato/Kamyroll-Python the old basic script (really easy to understand) https://github.com/hyugogirubato/Kamyroll-Python/blob/ffba19ec6f8c81dae4e5f35e368748fe2fca6494/kamyroll.py and my own C# implementation (based on that old kamyroll python version, easier to understand at least for me) https://github.com/federicorosso1993/Kamyroll-CSharp
I think the old crunchyroll log in support was already half broken (it required a cookies.txt file and the user agent), my own script and kamyroll-python do not require anything like that (my own implementation and the old version of kamyroll used this kind of code
var cookie = cookieContainer.GetCookies(uri).Cast().FirstOrDefault(x => x.Name == "etp_rt");
in C# and a code like this
r = requests.get(endpoint)
etp_rt = r.cookies.get("etp_rt")
in python
So it should be possible to avoid the request of a cookie file from the user. I know that the new kamyroll implemetation in python don’t even need that since it use the mobile api to log in. The old implementation use the desktop app api. My own implementation got also a comment with the web API implementation to log in (I made it as a comment because the desktop app api it’s already working as an alternative). You can use this page https://www.crunchyroll.com/welcome/login and this page https://www.crunchyroll.com/originals/it/index.html
to find the basic auth code (in a get with this url https://api.crunchyroll.com/start_session.0.json?sess_id=1&device_type=com.crunchyroll.static&device_id=whatvalueshouldbeforweb&access_token=giKq5eY27ny3cqz ) It’s always the same value and it will work to start the log in.
Not sure how to implement it in a large python app like yt-dlp (I’m not really skilled with python) but the code it’s already done and it’s working in another app (made just to fix youtube-dl and now yt-dlp).
Issue Analytics
- State:
- Created 2 years ago
- Comments:21 (16 by maintainers)
Top Related StackOverflow Question
Ah, I realized I misunderstood you.
self._download_jsonis a wrapper around urllib that parses the response as json before returning it, and becomes aGETin this case because I usedquery=.data=would produce aPOSTinstead.My process starts with a session id from a
GETtoget_upsell_data.0.json, then logs in with aPOSTtologin.1.json, which sets theetp_rtcookie needed for the beta extractor’s call toauth/v1/tokenon the beta api (and presumably also the non-beta mechanism works on the same cookie).I wanted to start with a
GETofhttps://www.crunchyroll.com/welcome/login, so that I didn’t need to hardcode anything at all, but was stymied by cloudflare.Cloudflare probably just thinks that specific IP is suspicious