-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
r33int
committed
Apr 2, 2018
1 parent
9037abd
commit 73164e8
Showing
2 changed files
with
60 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,62 @@ | ||
#!/bin/bash | ||
function jumpto | ||
{ | ||
label=$1 | ||
cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$') | ||
eval "$cmd" | ||
exit | ||
} | ||
|
||
cookiesstep=${1:-"cookiesstep"} | ||
|
||
|
||
#Some variables... | ||
urlregex='(http://crunchyroll.com/|http://www.crunchyroll.com)[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' | ||
qualityregex='[1-3]' | ||
|
||
echo Checking for youtube-dl... | ||
sleep 0.2 | ||
if ! type "youtube-dl" > /dev/null; then | ||
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 | ||
echo Press CTRL+C to exit. | ||
sleep infinity | ||
else | ||
sleep 0.5 | ||
clear | ||
tput setaf 6;echo Welcome! | ||
sleep 0.2 | ||
tput setaf 5;echo This script makes it easier to download anime videos from Crunchyroll using youtube-dl. | ||
sleep 0.2 | ||
echo Enjoy! | ||
sleep 0.2 | ||
echo | ||
tput setaf 2;read -e -p 'First, enter the link of the video you want to download: ' link | ||
function start { | ||
tput setaf 4; echo "Checking for youtube-dl..." | ||
sleep 0.2 | ||
if ! type "youtube-dl" > /dev/null; then | ||
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" | ||
echo Press CTRL+C to exit. | ||
sleep infinity | ||
else | ||
tput setaf 2;echo "youtube-dl has been found, we may continue!" | ||
sleep 0.1 | ||
tput reset | ||
cookie | ||
fi | ||
} | ||
|
||
if [[ $link =~ $urlregex ]] | ||
then | ||
sleep 0.5 | ||
clear | ||
PS3='Now, select the quality you want to use: ' | ||
options=("480p" "720p" "1080p" "Exit") | ||
select opt in "${options[@]}" | ||
do | ||
case $opt in | ||
"480p") | ||
quality='480' | ||
break | ||
;; | ||
"720p") | ||
quality='720' | ||
break | ||
;; | ||
"1080p") | ||
quality='1080' | ||
break | ||
;; | ||
"Exit") | ||
tput reset | ||
exit | ||
;; | ||
*) | ||
tput setaf 1;echo Invalid selection.;tput setaf 2;; | ||
esac | ||
done | ||
sleep 0.5 | ||
cookiesstep: | ||
clear | ||
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 | ||
if [ -f $cookies ] | ||
then | ||
echo Cookies file found. | ||
sleep 0.5 | ||
clear | ||
echo 'Where do you want to save your video? Empty input will save to the current path.' | ||
tput setaf 1;read -e -p 'Enter path: ' output | ||
sleep 0.5 | ||
clear | ||
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!' | ||
echo Starting download... | ||
sleep 0.5 | ||
tput setaf 4 | ||
if [$output = ""] | ||
then | ||
youtube-dl --write-sub --sub-lang enUS -f "best[height=$quality]" --cookies $cookies $link | ||
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' | ||
tput reset | ||
else | ||
youtube-dl -o "$output/%(title)s-%(id)s.%(ext)s" --write-sub --sub-lang enUS -f "best[height=$quality]" --cookies $cookies $link | ||
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' | ||
tput reset | ||
fi | ||
else | ||
tput setaf 1 echo Cookies file not found. Please try again. | ||
sleep 0.5 | ||
tput setaf 2 | ||
jumpto cookiesstep | ||
fi | ||
else | ||
function quit { | ||
tput setaf 5;echo "Exiting. Have a great day!" | ||
sleep 0.5 | ||
tput setaf 1; echo "Invalid link. Make sure you entered a Crunchyroll link." | ||
fi | ||
fi | ||
tput reset | ||
exit 1 | ||
} | ||
|
||
function cookie { | ||
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" | ||
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." | ||
echo "" | ||
tput setaf 6;read -e -p "Path: " cookies | ||
if [ -f $cookies ] | ||
then | ||
echo "" | ||
tput setaf 2;echo "Yep, I found the file you specified!" | ||
tput reset | ||
download-cookie | ||
else | ||
echo "" | ||
tput setaf 1;echo "You seem to have not specified a cookie file. Maximum quality is 480p." | ||
tput reset | ||
download-nocookie | ||
fi | ||
} | ||
|
||
function downloadcookie { | ||
echo test | ||
} | ||
|
||
function downloadnocookie { | ||
echo test | ||
} | ||
|
||
function path { | ||
echo test | ||
} | ||
|
||
tput reset | ||
sleep 0.2 | ||
start |