Skip to content

Commit 73164e8

Browse files
author
r33int
committed
crunchyrollDownloader is back and is better than ever!
The script has been revwritten from scratch! Hope you will appreciate it! This is also the first release.
1 parent 9037abd commit 73164e8

File tree

2 files changed

+60
-98
lines changed

2 files changed

+60
-98
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ This script downloads anime videos from Crunchyroll using youtube-dl.
99
### Requirements :
1010
1. Any Linux distribution. Other unix systems untested but should work.
1111
2. youtube-dl installed.
12-
3. A Crunchyroll account. You can use a free account but will only allow downloads up to 480p and premium episodes won't work.
12+
3. A Crunchyroll account. You can use a free account but this will only allow downloads up to 480p and premium episodes won't work.
1313
4. A working brain.
1414

1515
#### How does it work ?
16-
First, clone this repository. You can do that from GitHub web interface or with the command :
16+
First things first, clone this repository. You can do that from GitHub web interface or with the command:
1717
`git clone https://github.com/r33int/crunchyrollDownloader.git`
1818

19-
Then, make the script executable using
19+
Make the script executable using:
2020
`chmod +x crunchyroll-dl.sh`
2121

2222
Finally, execute it and follow the instructions.
@@ -28,6 +28,6 @@ To authentificate to Crunchyroll, you will need a cookies.txt file. To extract t
2828

2929
Once installed, go to crunchyroll.com, login if that's not already done (don't forget to tick "Stay logged in"), then click on the extensions's icon, and click download.
3030

31-
![](https://r33int.pw/pic/crdl.jpg)
31+
![](https://pic.r33.space/uploads/big/da7b0635af59caa0f5826f85e51d095b.png)
3232

33-
Finally, your cookies.txt file is ready.
33+
Finally, your cookies.txt file is ready. For convenience, I recommand putting this file in the folder where the script is.

crunchyroll-dl.sh

+55-93
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,62 @@
11
#!/bin/bash
2-
function jumpto
3-
{
4-
label=$1
5-
cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
6-
eval "$cmd"
7-
exit
8-
}
9-
10-
cookiesstep=${1:-"cookiesstep"}
11-
122

3+
#Some variables...
134
urlregex='(http://crunchyroll.com/|http://www.crunchyroll.com)[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
145
qualityregex='[1-3]'
156

16-
echo Checking for youtube-dl...
17-
sleep 0.2
18-
if ! type "youtube-dl" > /dev/null; then
19-
tput setaf 1;echo youtube-dl has not been found. Please install it and relaunch this script. If you are sure you have it installed, please open an issue on GitHub. https://l.r33.space/crdlissue
20-
echo Press CTRL+C to exit.
21-
sleep infinity
22-
else
23-
sleep 0.5
24-
clear
25-
tput setaf 6;echo Welcome!
26-
sleep 0.2
27-
tput setaf 5;echo This script makes it easier to download anime videos from Crunchyroll using youtube-dl.
28-
sleep 0.2
29-
echo Enjoy!
30-
sleep 0.2
31-
echo
32-
tput setaf 2;read -e -p 'First, enter the link of the video you want to download: ' link
7+
function start {
8+
tput setaf 4; echo "Checking for youtube-dl..."
9+
sleep 0.2
10+
if ! type "youtube-dl" > /dev/null; then
11+
tput setaf 1;echo "youtube-dl has not been found. Please install it and relaunch this script. If you are sure you have it installed, please open an issue on GitHub. https://l.r33.space/crdlissue"
12+
echo Press CTRL+C to exit.
13+
sleep infinity
14+
else
15+
tput setaf 2;echo "youtube-dl has been found, we may continue!"
16+
sleep 0.1
17+
tput reset
18+
cookie
19+
fi
20+
}
3321

34-
if [[ $link =~ $urlregex ]]
35-
then
36-
sleep 0.5
37-
clear
38-
PS3='Now, select the quality you want to use: '
39-
options=("480p" "720p" "1080p" "Exit")
40-
select opt in "${options[@]}"
41-
do
42-
case $opt in
43-
"480p")
44-
quality='480'
45-
break
46-
;;
47-
"720p")
48-
quality='720'
49-
break
50-
;;
51-
"1080p")
52-
quality='1080'
53-
break
54-
;;
55-
"Exit")
56-
tput reset
57-
exit
58-
;;
59-
*)
60-
tput setaf 1;echo Invalid selection.;tput setaf 2;;
61-
esac
62-
done
63-
sleep 0.5
64-
cookiesstep:
65-
clear
66-
read -e -p 'Enter the path of your cookies.txt file. Not sure of what it is? Check the readme on GitHub for details. https://l.r33.space/crdl: ' cookies
67-
if [ -f $cookies ]
68-
then
69-
echo Cookies file found.
70-
sleep 0.5
71-
clear
72-
echo 'Where do you want to save your video? Empty input will save to the current path.'
73-
tput setaf 1;read -e -p 'Enter path: ' output
74-
sleep 0.5
75-
clear
76-
tput setaf 5;echo 'Alright. At the moment, this script downloads english subtitles at the moment. If you need another language, feel free to modify the script!'
77-
echo Starting download...
78-
sleep 0.5
79-
tput setaf 4
80-
if [$output = ""]
81-
then
82-
youtube-dl --write-sub --sub-lang enUS -f "best[height=$quality]" --cookies $cookies $link
83-
tput setaf 2;echo 'youtube-dl command has completed! Download should be done. If you have encountered any issue, please open an issue on GitHub. https://l.r33.space/crdlissue'
84-
tput reset
85-
else
86-
youtube-dl -o "$output/%(title)s-%(id)s.%(ext)s" --write-sub --sub-lang enUS -f "best[height=$quality]" --cookies $cookies $link
87-
tput setaf 2;echo 'youtube-dl command has completed! Download should be done. If you have encountered any issue, please open an issue on GitHub. https://l.r33.space/crdlissue'
88-
tput reset
89-
fi
90-
else
91-
tput setaf 1 echo Cookies file not found. Please try again.
92-
sleep 0.5
93-
tput setaf 2
94-
jumpto cookiesstep
95-
fi
96-
else
22+
function quit {
23+
tput setaf 5;echo "Exiting. Have a great day!"
9724
sleep 0.5
98-
tput setaf 1; echo "Invalid link. Make sure you entered a Crunchyroll link."
99-
fi
100-
fi
25+
tput reset
26+
exit 1
27+
}
28+
29+
function cookie {
30+
tput setaf 6;echo "First of all, let's identify you! If you want to use an account, please specify the path of your cookies.txt file. Not sure about what I am talking about? Check README for more details. https://l.r33.space/crdl"
31+
tput setaf 5;echo "If you do not want to use an account, just press enter. Please keep in mind that without an account, you will not be able to download premium-only videos and maximum quality is 480p."
32+
echo ""
33+
tput setaf 6;read -e -p "Path: " cookies
34+
if [ -f $cookies ]
35+
then
36+
echo ""
37+
tput setaf 2;echo "Yep, I found the file you specified!"
38+
tput reset
39+
download-cookie
40+
else
41+
echo ""
42+
tput setaf 1;echo "You seem to have not specified a cookie file. Maximum quality is 480p."
43+
tput reset
44+
download-nocookie
45+
fi
46+
}
47+
48+
function downloadcookie {
49+
echo test
50+
}
51+
52+
function downloadnocookie {
53+
echo test
54+
}
55+
56+
function path {
57+
echo test
58+
}
59+
60+
tput reset
61+
sleep 0.2
62+
start

0 commit comments

Comments
 (0)