Written by Mahmoud Ahmadinejad on 10:19 PM

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.
Sourced from : Linux By Examples

| Posted in »
Linux