Skip to content
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

[crunchyroll] premium account does not work #17840

Closed
5 of 9 tasks
Dabverse opened this issue Oct 8, 2018 · 6 comments
Closed
5 of 9 tasks

[crunchyroll] premium account does not work #17840

Dabverse opened this issue Oct 8, 2018 · 6 comments

Comments

@Dabverse
Copy link

Dabverse commented Oct 8, 2018

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.10.05. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.10.05

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

youtube-dl.exe -U
youtube-dl is up-to-date (2018.10.05)

youtube-dl -v -f "best[height=720]" -o "%(title)s.%(ext)s" --all-subs --sub-format best -u mypremiumaccount -p mypassword https://www.crunchyroll.com/dragon-ball-super/episode-1-the-peace-reward-who-will-get-the-100-million-zeni-723163
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-f', 'best[height=720]', '-o', '%(title)s.%(e
xt)s', '--all-subs', '--sub-format', 'best', '-u', 'PRIVATE', '-p', 'PRIVATE', '
https://www.crunchyroll.com/dragon-ball-super/episode-1-the-peace-reward-who-wil
l-get-the-100-million-zeni-723163']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2018.10.05
[debug] Python version 3.4.4 (CPython) - Windows-8.1-6.3.9600
[debug] exe versions: ffmpeg 4.0.2, ffprobe 4.0.2
[debug] Proxy map: {}
[crunchyroll] Logging in
[crunchyroll] 723163: Downloading webpage
ERROR: crunchyroll returned error: Nota: Este vídeo requer uma <a href="/freetri
al?src=geo_sm">Assinatura Premium</a> para ser assistido em sua região.
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\bu
ild\youtube_dl\YoutubeDL.py", line 792, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\bu
ild\youtube_dl\extractor\common.py", line 507, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\bu
ild\youtube_dl\extractor\crunchyroll.py", line 438, in _real_extract
youtube_dl.utils.ExtractorError: crunchyroll returned error: Nota: Este vídeo re
quer uma <a href="/freetrial?src=geo_sm">Assinatura Premium</a> para ser assisti
do em sua região.

Description of your issue, suggested solution and other information

I get this error when trying to download crunchyroll premium videos. My Crunchyroll account is Premium, I can only share my account with admin for testing purposes

account

@baconwaifu
Copy link

baconwaifu commented Oct 10, 2018

Crunchyroll put their login page behind cloudflare's anti-bot filter. A workaround is to visit the site using a regular browser, and then dump the cloudflare ID token into a cookies.txt file to use with youtube-dl (I used to have a little stub script to somewhat automate it with firefox, I'll have to look for it again) Note that you also have to change youtube-dl's user agent to match that of the browser you used to pass the check.

EDIT: Here's the script. copy the 'cookies.sqlite' from firefox into the same directory as the script, and it produces a cookies.txt in the same directory.

#!/usr/bin/env python3
import sqlite3
import http.cookiejar

def get_cookies(cj, ff_cookies):
    con = sqlite3.connect(ff_cookies)
    cur = con.cursor()
    cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies WHERE baseDomain=?", ('crunchyroll.com',))                                                                                     
    for item in cur.fetchall():
        c = http.cookiejar.Cookie(0, item[4], item[5],
            None, False,
            item[0], item[0].startswith('.'), item[0].startswith('.'),
            item[1], False,
            item[2],
            item[3], item[3]=="",
            None, None, {})
        print(c)
        cj.set_cookie(c)

cj = http.cookiejar.MozillaCookieJar()
get_cookies(cj, "cookies.sqlite")
cj.save("cookies.txt")

Then run youtube-dl like so, followed by the other options you use:
youtube-dl --user-agent [UA of browser] --cookies cookies.txt

@Dabverse
Copy link
Author

thank you so much

@nascalsn
Copy link

Crunchyroll put their login page behind cloudflare's anti-bot filter. A workaround is to visit the site using a regular browser, and then dump the cloudflare ID token into a cookies.txt file to use with youtube-dl (I used to have a little stub script to somewhat automate it with firefox, I'll have to look for it again) Note that you also have to change youtube-dl's user agent to match that of the browser you used to pass the check.

EDIT: Here's the script. copy the 'cookies.sqlite' from firefox into the same directory as the script, and it produces a cookies.txt in the same directory.

#!/usr/bin/env python3
import sqlite3
import http.cookiejar

def get_cookies(cj, ff_cookies):
    con = sqlite3.connect(ff_cookies)
    cur = con.cursor()
    cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies WHERE baseDomain=?", ('crunchyroll.com',))                                                                                     
    for item in cur.fetchall():
        c = http.cookiejar.Cookie(0, item[4], item[5],
            None, False,
            item[0], item[0].startswith('.'), item[0].startswith('.'),
            item[1], False,
            item[2],
            item[3], item[3]=="",
            None, None, {})
        print(c)
        cj.set_cookie(c)

cj = http.cookiejar.MozillaCookieJar()
get_cookies(cj, "cookies.sqlite")
cj.save("cookies.txt")

Then run youtube-dl like so, followed by the other options you use:
youtube-dl --user-agent [UA of browser] --cookies cookies.txt

It did not work for me. Any idea?

@Dabverse
Copy link
Author

Crunchyroll put their login page behind cloudflare's anti-bot filter. A workaround is to visit the site using a regular browser, and then dump the cloudflare ID token into a cookies.txt file to use with youtube-dl (I used to have a little stub script to somewhat automate it with firefox, I'll have to look for it again) Note that you also have to change youtube-dl's user agent to match that of the browser you used to pass the check.
EDIT: Here's the script. copy the 'cookies.sqlite' from firefox into the same directory as the script, and it produces a cookies.txt in the same directory.

#!/usr/bin/env python3
import sqlite3
import http.cookiejar

def get_cookies(cj, ff_cookies):
    con = sqlite3.connect(ff_cookies)
    cur = con.cursor()
    cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies WHERE baseDomain=?", ('crunchyroll.com',))                                                                                     
    for item in cur.fetchall():
        c = http.cookiejar.Cookie(0, item[4], item[5],
            None, False,
            item[0], item[0].startswith('.'), item[0].startswith('.'),
            item[1], False,
            item[2],
            item[3], item[3]=="",
            None, None, {})
        print(c)
        cj.set_cookie(c)

cj = http.cookiejar.MozillaCookieJar()
get_cookies(cj, "cookies.sqlite")
cj.save("cookies.txt")

Then run youtube-dl like so, followed by the other options you use:
youtube-dl --user-agent [UA of browser] --cookies cookies.txt

It did not work for me. Any idea?

tutorial for Windows (my windows is 8.1)
01 - install Firefox: https://www.mozilla.org/pt-BR/firefox/new/
02 - install Python 3: https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe
03 - create a folder on the desktop
04 - in this folder create a text file (notepad)
05 - copy and paste script of baconwaifu in text file, save the file with end .py
06 - in Firefox press "Ctrl + Shift + Del", select everything and clean
07 - log in crunchyroll with Firefox: https://www.crunchyroll.com/login
08 - get your user agent: https://www.whatismybrowser.com/detect/what-is-my-user-agent
example: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

09 - close Firefox
10 - press "WinKey + R" and type it: %appdata%\Mozilla\Firefox\Profiles
11 - find and copy the file cookies.sqlite to folder created in desktop
12 - run the script.py and copy the generated file "cookies.txt" to youtube-dl folder
13 - run youtube-dl with --user-agent [UA of browser] --cookies cookies.txt
example:
for download in 720p and all subs
youtube-dl -i -c --cookies cookies.txt --user-agent "Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0" -f "best[height=720]" --all-subs --sub-format best https://www.crunchyroll.com/dragon-ball-super/episode-131-the-miraculous-conclusion-farewell-goku-until-we-meet-again-760351

@nascalsn
Copy link

Crunchyroll put their login page behind cloudflare's anti-bot filter. A workaround is to visit the site using a regular browser, and then dump the cloudflare ID token into a cookies.txt file to use with youtube-dl (I used to have a little stub script to somewhat automate it with firefox, I'll have to look for it again) Note that you also have to change youtube-dl's user agent to match that of the browser you used to pass the check.
EDIT: Here's the script. copy the 'cookies.sqlite' from firefox into the same directory as the script, and it produces a cookies.txt in the same directory.

#!/usr/bin/env python3
import sqlite3
import http.cookiejar

def get_cookies(cj, ff_cookies):
    con = sqlite3.connect(ff_cookies)
    cur = con.cursor()
    cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies WHERE baseDomain=?", ('crunchyroll.com',))                                                                                     
    for item in cur.fetchall():
        c = http.cookiejar.Cookie(0, item[4], item[5],
            None, False,
            item[0], item[0].startswith('.'), item[0].startswith('.'),
            item[1], False,
            item[2],
            item[3], item[3]=="",
            None, None, {})
        print(c)
        cj.set_cookie(c)

cj = http.cookiejar.MozillaCookieJar()
get_cookies(cj, "cookies.sqlite")
cj.save("cookies.txt")

Then run youtube-dl like so, followed by the other options you use:
youtube-dl --user-agent [UA of browser] --cookies cookies.txt

It did not work for me. Any idea?

tutorial for Windows (my windows is 8.1)
01 - install Firefox: https://www.mozilla.org/pt-BR/firefox/new/
02 - install Python 3: https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe
03 - create a folder on the desktop
04 - in this folder create a text file (notepad)
05 - copy and paste script of baconwaifu in text file, save the file with end .py
06 - in Firefox press "Ctrl + Shift + Del", select everything and clean
07 - log in crunchyroll with Firefox: https://www.crunchyroll.com/login
08 - get your user agent: https://www.whatismybrowser.com/detect/what-is-my-user-agent
example: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

09 - close Firefox
10 - press "WinKey + R" and type it: %appdata%\Mozilla\Firefox\Profiles
11 - find and copy the file cookies.sqlite to folder created in desktop
12 - run the script.py and copy the generated file "cookies.txt" to youtube-dl folder
13 - run youtube-dl with --user-agent [UA of browser] --cookies cookies.txt
example:
for download in 720p and all subs
youtube-dl -i -c --cookies cookies.txt --user-agent "Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0" -f "best[height=720]" --all-subs --sub-format best https://www.crunchyroll.com/dragon-ball-super/episode-131-the-miraculous-conclusion-farewell-goku-until-we-meet-again-760351

Thank you. I made the process in Windows 10 and it worked, but in linux (openSUSE) my main system only worked once.

@DuBistKomisch
Copy link

Thanks guy, this workaround worked for me too on Arch Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants