khdl 550 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. dirname=$(basename "$@")
  3. mkdir -p "$dirname"
  4. cd "$dirname"
  5. tracklist=$(curl -s "$*" | sed -nE 's;.*href="(/game.*.mp3)"><i.*;https://downloads.khinsider.com\1;p' | uniq)
  6. echo $tracklist
  7. for i in $tracklist; do
  8. document=$(curl -s $i)
  9. # track=$(echo "$document" | grep -m 1 -o "http.*flac")
  10. # if [ -z "$track" ]; then
  11. # echo 'no flacs my friend'
  12. track=$(echo "$document" | grep -m 1 -o "http.*mp3")
  13. # fi
  14. echo $track
  15. curl -C - -O $track
  16. done &&
  17. for i in *; do mv "$i" $(echo $i | sed -E 's/(%20)+/_/g;s/%([0-9]|[A-F])+//g'); done
  18. cd ..