Skip to content

Instantly share code, notes, and snippets.

@yshalsager
Last active September 2, 2018 14:09
Show Gist options
  • Save yshalsager/ff76edf6900563608497473b348f9511 to your computer and use it in GitHub Desktop.
Save yshalsager/ff76edf6900563608497473b348f9511 to your computer and use it in GitHub Desktop.
anidl.tk Downloader
#!/bin/bash
# anidl.tk Downloader
# by yshalsager
url=$2
quality=$3
function fetch_page() {
curl -s $url | tr '>' '\n' | grep $quality | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*" | sed -n '/folder/!p' >> links.txt
}
function fetch_folder() {
curl -s $url | grep download_icon.png | tr '>' '\n' | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*" | sort -u | sed -n '/themes/!p' >> links.txt
}
function download() {
for list in links.txt; do wget --content-disposition -i $list ;done
}
function clean() {
rm links.txt 2> /dev/null
}
if [[ $1 == "-h" || $1 == "--help" || "$#" -lt 3 ]]
then
clean
echo "Usage: ./ani-dl.sh [argument] url quality"
echo "-p for fetch links from a Page"
echo "-f for fetch links from a Folder"
echo "Quality should be 720p or 480p and it works with -p only"
exit
elif [[ $1 == "-p" ]]; then
clean
echo "Fetching from a Page (quality=$quality)"
fetch_page
echo "Downloading..."
download
clean
elif [[ $1 == "-f" ]]; then
clean
echo "Fetching from a Folder"
fetch_folder
echo "Downloading..."
download
clean
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment