write a online manga downloader using bash

November 29th, 2007 mysurface Posted in Bash, seq, Text Manipulation, wget | Hits: 85371 | 9 Comments »

onep.png
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]

9 Responses to “write a online manga downloader using bash”

  1. 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”

  2. Jim: awesome!
    I have no idea why http url with ” ” didn’t works for me. I did some changes and it works! Thanks.

    curl -o OnePiece_Vol_01_#1.jpg http://c1.kukudm.com/comic/kuku2comic/OnePiece/Vol_01/OnePiece_01_001-104.jpg
  3. to mysurface:
    Please note that, it should be ["], not [”].

  4. I inputed ["] (half), but after it’s published, I found it became [”] (full) in the webpage…

  5. I really enjoyed this posting! Your site looks greet !

  6. magnificent publish, very informative. I ponder why the opposite experts of this sector do not understand this. You should continue your writing. I’m confident, you’ve a huge readers’ base already!

  7. You’re the best! nice read. i blog about health and LifeDrVitamins. we hope you have a great weds.

  8. [...] Sumber Like this:LikeBe the first to like this post. [...]

  9. Good post. I learn something new and challenging on sites I stumbleupon every day.
    It’s always exciting to read through articles from other
    authors and practice a little something from other
    web sites.

Leave a Reply