Created
May 25, 2018 00:56
-
-
Save alexshpilkin/08060e49653e6c3430b960c1501733c4 to your computer and use it in GitHub Desktop.
Download series from AOS
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
#!/bin/sh -eu | |
set -o pipefail | |
# mkdir sub; for file in *.mp4; do n=${file#*#}; n=${n%% *}; mv "$file" "sub/$(printf '%02d - Episode %d.mp4' $n $n)"; done | |
myvi() { | |
youtube-dl -c -R inf --socket-timeout 1 -o "$2" $( | |
curl -sS 'http://animeonline.su/zend/anime/myvi/index/id/'"$1" \ | |
| sed -Ene 's/.*"url": +"([^"]*)".*/\1/p' | head -1 \ | |
| sed 's|player/embed/html|watch|' | |
) | |
} | |
mkdir -p rus sub | |
i=1; (( r = $(date -u +%H) + $(date -u +%S) + $(date -u +%N | cut -c 1-3) )) | |
curl -sS 'http://animeonline.su/zend/anime/one/data/?r='$r'&anime_id='"$1" \ | |
| jq -r '.episodes[] | "\(.n) \(.t) \(.rus.m) \(.sub.m)"' \ | |
| while read n t rus sub; do | |
case $t in | |
(0) type=Episode ;; | |
(1) type=Bonus ;; | |
(2) type=Special ;; | |
esac | |
name=$(printf '%02d - %s %d.%%(ext)s' $i $type $n) | |
myvi "$sub" "sub/$name" | |
myvi "$rus" "rus/$name" | |
(( i++ )) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment