Monday, February 23, 2009

One Manga Downloader

I'm a fan of Japanese manga, and one of my manga source is www.onemanga.com. It delivers outstanding manga, but then I can't find any suitable downloader that can be used for downloading manga from this site. Therefore... I created a downloader my self.

I created the downloader using Visual Basic 6.0 with some help from a friend of mine... Thanks a lot babah Ian, for telling me the steps of creating a downloader. Since this is my first time to create a program that connects to the internet and tampering with file, please do inform me about the bugs. :D

You can download the downloader in here.

A Brief explanation about how to use the downloader...
You'll be presented with a text box.  You have to insert the link on that text box.  
1.  First, open the www.onemanga.com, pick your manga, and open a manga page.
2. Copy the link of the manga page (it will look like "www.onemanga.com/naruto/349/001/") to the text box.
3. Tick the proxy if you use proxy.
-  If you use proxy, be sure to insert the port after the proxy address. e.g. proxy.me:3223
4. Click download, and it will download the manga for you until there are no more manga to view in the selected manga.
5. Check in your C drive for the manga title.

P.S.  It will automatically overwrite existing manga that you have downloaded if they have the same name.

A brief explanation about coding a downloader in Visual Basic :

1. Add references : Microsoft Scripting Runtime (scrrun.dll) : Used for checking the existance of a directory or a file.
2. Add Microsoft Internet Transfer Control Component (MSInet.OCX) : Used for creating connection to the internet, downloading a file.
3. Use the inet object to create a connection to the internet, then open a file.
Inet1.AccessType = icDirect (direct connection to the internet, while icProxy for proxy)
Inet1.OpenURL("www.google.com") for instance will download the html file from the internet.
You can check the html by redirecting Inet1.OpenURL("www.google.com") to a multicolumn textbox.

4. Now you need to parse the text, to lookup for the image download source. Then once again you need to use Inet1.OpenURL (picture link) and save it to a file.

5. When you want to save the file, say a JPEG file you need to instiantiate a couple of variable such
Dim bData() As Byte
Dim intFile As Integer
intFile = FreeFile()

6. Then you need to check for existing directory
DirExists ("C:\" & FRoot)
DirExists ("C:\" & FRoot & "\" & FMid)

7. Saving the data into byte array
bData() = Inet1.OpenURL(strURL, icByteArray)
FileExists ("C:\" & FRoot & "\" & FMid & "\" & FName & ".jpg")

8. Creating a file and saving it
Open "C:\" & FRoot & "\" & FMid & "\" & FName & ".jpg" For Binary Access Write As #intFile

9. Put the byte code into a file
Put #intFile, , bData()

10. Close the file
Close #intFile

And there you will have your downloader :D

For parsing the HTML, I mostly get help from an article by Danny Elkins a.k.a DigiRev from his tutorial in VBForum, all others I used the MSDN for help :D

Hello World !

Hello Guys... This blog will talk about my knowledge in coding and other aspect of computing... :D