Skip to content

Instantly share code, notes, and snippets.

@shichao-an
Created April 19, 2014 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shichao-an/11098080 to your computer and use it in GitHub Desktop.
Save shichao-an/11098080 to your computer and use it in GitHub Desktop.
Download manga images
#!/bin/bash
# Brynhildr in the Darkness (Chinese ver.)
usage="./batch.sh chapter pages"
[ "$#" -lt 2 ] && { echo "$usage"; exit 1; }
declare -i chapter="$1"
declare -i pages="$2"
_page='$$'
printf -v _chapter "%.2d" "$chapter"
raw_url="http://imgfast.dmzj.com/j/%E6%9E%81%E9%BB%91%E7%9A%84%E5%B8%83%E4%BC%A6%E5%B8%8C%E5%B0%94%E7%89%B9/${_chapter}/%E7%AC%AC1%E8%AF%9D_00${_page}.jpg"
url=$(echo "$raw_url" | sed -e 's/%/%%/g' -e 's/\$\$/%.2d/g')
for page in $(seq 1 "$pages")
do
printf -v _url "$url" "$page"
wget "$_url" --restrict-file-names=ascii
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment