write a online manga downloader using bash
November 29th, 2007 mysurface Posted in Bash, Text Manipulation, seq, wget | Hits: 22005 |

There are plenty of site that allows you to read manga online, but you have to tolerate for the slow access and ton’s of heavy loaded ads. You can’t download the manga directly using batch download provided by wget or any download manager. but if you know how to do bash script, you could somehow download them.
Those online site usually store manga in jpg format, with name of some patterns, and stores in the same folder. If you manage to know the first image filename and the last image filename in a particular folder, you can download them using seq command with bash do loop. Let say the first image and the last image’s name is in this format:
http://c1.kukudm.com/comic/kuku2comic/OnePiece/Vol_01/OnePiece_01_001.jpg
http://c1.kukudm.com/comic/kuku2comic/OnePiece/Vol_01/OnePiece_01_104.jpg
You can guess, the images between them should be 001, 002, 003 until 104. Therefore a simple bash script will looks like this:
#!/bin/bash
for i in `seq -f"%03g" 1 104`
do
wget -c "http://c1.kukudm.com/comic/kuku2comic/OnePiece/Vol_01/OnePiece_01_$i.jpg"
done
Seq allows you to define printf like formating by specified with -f, %03g is actually tells seq I got three digits, fill the blank digits with 0, and the range is from 1 to 104. After that, use wget to download them. Simple isn’t it?
You can run bash script under windows platform too if you have cygwin installed. But bare in mind, not all manga are downloadable with this technique. Certain site pad the image’s filename with some random characters, that prevent downloads by this simple script.
[tags]bash scripts, comic, manga, download scripts[/tags]
Live Chat!









November 29th, 2007 at 11:01 pm
Same thing with curl, no loop required:
curl -o OnePiece_Vol_01_#1 “http://c1.kukudm.com/comic/kuku2comic/OnePiece/Vol_01/OnePiece_01_[001-104].jpg”
November 30th, 2007 at 10:00 am
Jim: awesome!
I have no idea why http url with ” ” didn’t works for me. I did some changes and it works! Thanks.
January 21st, 2008 at 9:37 pm
to mysurface:
Please note that, it should be ["], not [â€].
January 21st, 2008 at 9:39 pm
I inputed ["] (half), but after it’s published, I found it became [â€] (full) in the webpage…