Easy way to make epub from baka-tsuki

Wish to express your thanks and salutations? And PDF's? Find your Novel Series topic here

Moderators: Fringe Security Bureau, Senior Editors, Senior Translators, Alt. Language Translator/Editor, Executive Council, Project Translators, Project Editors

Locked
User avatar
hypernova
Mikuru's Master
Posts: 20
Joined: Tue Jan 22, 2013 8:35 pm
Favourite Light Novel:

Easy way to make epub from baka-tsuki

Post by hypernova »

If you're like me who prefer epub over pdf (in fact, pdf hardly works on my e-reader), I'd like to share with you my way of making epub from BT project. With the BT-GEN is no longer updated, I've found that this to be the best way to make one. It takes from 3-15 minutes, depend on how high quality you want your epub to be. Most of the steps are optional too.

What you'll need:
1. Calibre
2. Firefox with GrabMyBooks (required) and ImageHost Grabber (optional)
3. (Optional) Notepad++, or any editor with Replace function that support regular expression

GrabMyBooks is the main tool here. You may already know about it. If you make sure to check "Grab images" and "Grab target images", it produce a very good result. In fact, I would just use that on other site. Unfortunately, for a Wikimedia site like BT, the images it grab are usually thumbnails, and the best you can do automatically is set width=300 in your preference, which is still way too small. That's where ImageHost Grabber and Calibre come in. Let's go to the steps.

Steps:
1. Use GrabMyBook to grab the page you want. Grabbing from the full text page is probably the quickest, but you can open all pages in tabs and use "Grab Tabs" option too.
2. (Optional) Go to GrabMyBook->My Book. Click Edit, then clean up the content at the top and navigation link on the bottom
3. Save the epub from GrabMyBook.

Here you already have a reasonably readable epub, but if you want a better one, keep reading

Optional steps 1: Getting rid of the "edit" link

1. Back to GrabMyBook->My Book->Edit again.
2. Copy everything to notepad++
3. Go to Search->Replace
4. In Search Mode, chose regular expression
5. Put in "\[\$lnk.+?edit\}lnk\$ \]" without quite in the Find what box
6. Leave the Replace with blank
7. Click Replace all
8. Copy everything back to GrabMyBook Edit page. Save, and then save your epub.

Optional steps 2: Getting high quality images:

1. (One time only) Right click in firefox. Go to ImageHost Grabber->Host File Editor. Choose "Wikimedia" from Select host dropdown box. Change Host Label to something like "baka-tsuki", then change URL Pattern to "baka-tsuki\.org.+" (without quote), then click Add Host.
2. Go to the Illustrations page or the full text page, then right click->ImageHost Grabber->Get selected pics on page. Choose the images that is part of the project. Usually it looks like this:

Code: Select all

http://www.baka-tsuki.org/project/index.php?title=File:Something.jpg
Then click ok to download them.
3. Add the epub from GrabMyBook to Calibre, then right click on it and select "Edit Book"
4. Open book.css. Delete the two lines that has imgBig in them. This will make your image shows at a bigger size
5. You'll see the list of image files in the book. Replace them one by one by right click on it, choose "Replace <filename> with files..." and choose the full-sized image you download using ImageHost Grabber. Don't worry about the image reference in the book. It'll take care of that automatically.
6. Once you're done. Save.

Now you have an epub with much better images. Still, most likely the table of content has only one entry. Let's fix that.

Optional steps 3: Fixing the ToC
1. Go back to Edit Book in Calibre again.
2. Click the button with "T" on it (Edit Table of Content)
3. Delete the old entry.
4. Now this one is a bit tricky. I think GrabMyBook unfortunately scrapped all the heading tag. The best thing you can do is probably use "Generate ToC from XPath" option. Then look for anything with a <b> tag. (Use the wizard button, or type in "//h:b" without the quote). Then remove the extra entries you don't want.
5. Save.

Finally, especially if you make one from full text link, the html file is most likely too big for an e-reader. This one is easy to solve--simply ask Calibre to convert your epub to epub, and it'll generate a new epub with splitted html files. When you're in the convert dialog, make sure you set Page setup->Output profile to Tablet. That way it won't reduce the size of your images.

That's it! I hope someone will find this useful (I spent time typing them after all :)). In retrospect, if you do the whole thing it's not that "easy". If anyone know a faster way, please share!

Edit: More useful Search & Replace. Export from my Calibre's edit book saved search:

Code: Select all

{
  "searches": [
    {
      "case_sensitive": false, 
      "dot_all": false, 
      "find": "\\[<a.+edit</a> \\]", 
      "mode": "regex", 
      "name": "Remove edit link", 
      "replace": ""
    }, 
    {
      "case_sensitive": false, 
      "dot_all": false, 
      "find": "<p><b>(.*?)</b></p>", 
      "mode": "regex", 
      "name": "<p><b> to <h2>", 
      "replace": "<h2>\\1</h2>"
    }, 
    {
      "case_sensitive": false, 
      "dot_all": false, 
      "find": "<h2>.*?</h2>", 
      "mode": "regex", 
      "name": "Remove h2", 
      "replace": ""
    }, 
    {
      "case_sensitive": false, 
      "dot_all": false, 
      "find": "<span\\sclass\\=\\\"img(.*?)\\\">(.*?)</span>", 
      "mode": "regex", 
      "name": "Remove imgSmall/Big span", 
      "replace": "\\2"
    }, 
    {
      "case_sensitive": false, 
      "dot_all": true, 
      "find": "<table border\\=\\\"1\\\">.+</table>", 
      "mode": "regex", 
      "name": "Remove navigation", 
      "replace": ""
    }
  ], 
  "version": 1
}
Last edited by hypernova on Sun Oct 04, 2015 12:47 pm, edited 1 time in total.
User avatar
Ansem93
Astral Realm

Overlord epub?

Post by Ansem93 »

Hi at all!
I really want to read overlord on my kindle, but i can found any epub/mobi/azw3 file :(
Here's the light novel on bakatsuki:
https://www.baka-tsuki.org/project/inde ... e=Overlord
how can i obtain the epub version of this books?
User avatar
wayvern33
Kyonist
Posts: 10
Joined: Wed Sep 10, 2014 4:40 pm
Favourite Light Novel: Ahouka!

Re: Easy way to make epub from baka-tsuki

Post by wayvern33 »

search google, someone probably have already made an epub out of it
Mors
Reader
Posts: 9
Joined: Sat Nov 19, 2011 8:08 am
Favourite Light Novel:

Re: Overlord epub?

Post by Mors »

Ansem93 wrote:Hi at all!
I really want to read overlord on my kindle, but i can found any epub/mobi/azw3 file :(
Here's the light novel on bakatsuki:
https://www.baka-tsuki.org/project/inde ... e=Overlord
how can i obtain the epub version of this books?
Try Armaell's Library.
Locked

Return to “Appreciation & PDF”