Mokuro

Read Japanese manga with selectable text inside a browser.

Manga guide

Mokuro

ZXY101's Mokuro fork

Manga collection


Guide to mining manga:

Preface:

This guide is assumes you already have your base mining workflow setup and only contains instructions on how to mine manga.

If you're brand new to learning Japanese I recommend you check out The Moe Way guide and the Lazy guide.

Using mokuro:

To process manga we use mokuro, a tool that processes your manga with manga-ocr to extract all of the text, then generates a manga viewer as an html file that you can open.

This guide relies on a fork of mokuro that adds various improvements and new features to the manga viewer.

The repos contain detailed usage instructions, but in short:

  1. Ensure you have python installed, I personally recommend using Anaconda
  2. Install ZXY101's mokuro fork (you will need to have git installed if you don't already): pip install git+https://github.com/ZXY101/mokuro.git@master If you wish to use the default mokuro, you can install it with: pip3 install mokuro
  3. Once mokuro is installed you can run it on a volume of manga like so:
  4. mokuro "/path/to/manga/volume 1" This will generate the html file for the one volume of manga, if you wish to process multiple volumes you can pass in multiple paths or you can specify the parent directory: mokuro --parent_dir manga_title/ Using ZXY101's fork, it will also generate .mobile.html files that are optimised for viewing on mobile devices, the fork also disables asking for confirmation by default.
    If you wish to disable mobile file generation, you can do so by setting the mobile flag to False mokuro --parent_dir manga_title/ --mobile False
For info on pre-processed manga, see Manga collection

-- The mining sections below assume you are using manga processed with ZXY101's mokuro fork --

If you would like to use the fork but already have a ton of processed manga, you can use this python script to quickly reprocess your manga. If you still have your _ocr folders then you can simply rerun mokuro with the fork to update your html files. python generate_ocr_files.py "manga_title/" --run_mokuro The above command will generate the ocr files for all the html files in the directory specified then rerun mokuro on the directory. PS. You need to have Beautiful Soup installed if you dont already, pip install beautifulsoup4.


Mining on PC:

ZXY101's mokuro fork adds anki connect integration, assuming you have your yomichan workflow setup correctly - you can now configure mokuro to be able to quickly create new cards.

showcase

The fork adds the ability to instantly add the selected sentence and image to your last created card.

To configure anki connect, open the advanced settings from the dropdown menu and tick Enable anki connect integration?

showcase

Advanced settings:

Setting up anki connect integration:

Due to secuirity concerns, browsers set various limitations on local files. Unfortunately this means that you cannot use the anki connect integration if you open your html files directly.

To get around this issue, you will need to host your manga over a simple http server. You can get a server up and running in under 2min depending on what you already have installed. Once your server is up, you will need to update your anki connect plugin config to allow requests from your server. Anki connect allows localhost by default, but your server may be hosted on a specific port (eg. 8000/8080) so you will need to add that to your allow list.

Adding servers to your webCorsOriginList:

  1. In anki, click Tools > Add-ons
  2. Select AnkiConnect then click the Config button
  3. You should see something like this:
    {
      "apiKey": null,
      "apiLogPath": null,
      "ignoreOriginList": [],
      "webBindAddress": "127.0.0.1",
      "webBindPort": 8765,
      "webCorsOriginList": [
          "http://localhost",
          "null"
      ]
    }
    Add the server domain to the webCorsOriginList.

    For example, if you would like to use anki connect with manga on mokuro.moe/manga as well as your own server you would need to add https://www.mokuro.moe and http://localhost:{your port number goes here} to the list like so:
    {
      "apiKey": null,
      "apiLogPath": null,
      "ignoreOriginList": [],
      "webBindAddress": "127.0.0.1",
      "webBindPort": 8765,
      "webCorsOriginList": [
          "http://localhost",
          "http://localhost:8000",
          "http://localhost:8080",
          "https://www.mokuro.moe",
          "https://mokuro.moe",
          "null"
      ]
    }

    Note: You can access mokuro.moe from both www.mokuro.moe and mokuro.moe so be sure to add both to the list . Also I add both localhost:8000 and localhost:8080 because I have servers on both ports, but you only need to specify whatever port you're using.

    If it's still not working after adding your server to the list you can try temporarily adding "*" to the list, if that works then you may have entered your server incorrectly.

  4. Once done, click Ok.

Configuring mokuro settings:

The last thing you need to do is enable anki connect integration in the advanced settings then specify your sentence and picture fields.

If you've already configured your anki settings to grab sentences, you may still want to use sentence grabbing since it will grab the entire dialog block without any parsing issues. It will also do it's best to preserve any existing html you may have in your sentence. If you would prefer it to not touch the sentence at all, simply disable sentence grabbing

Once you've configured all of your settings, click the Export settings button and store the settings.json file somewhere. Whenever you start a new manga/volume you can now import your settings and not need to worry about reconfiguring everything.


Mining on Android:

When it comes to mining from manga on Android devices, you have two options: Jidoujisho and Kiwi browser.

There are advantages and disadvantages to both methods, choose whicher suites your preference.

Jidoujisho:

Jidoujisho is an incredible android app that contains a suite of tools to help you immerse on mobile. It incorporates it's own popup dictionary where you can load up and configure your existing yomichan disctionaries. Once fully configured the experience is almost on par with a full yomichan/pc workflow, Jidoujisho makes adding cards on mobile very easiy with auto audio/sentence/picture grabbing and generation.

Jidoujisho has a reader specifically designed for mokuro files that adds the ability to navigate using the volume keys. For the best experience, use the mokuro fork to generate .mobile.html files and open them up in Jidoujisho. The mobile files adds easier to access navigation buttons as well as the ability to navigate with swipe gestures.

To add manga to Jidoujisho, you can either load up local files or read them directly from a server.

Since Jidoujisho handles card creation for you, you should make sure that anki connect integration is disabled in the mokuro advanced settings.

jido

Kiwi browser:

Kiwi browser is a chromium based browser that supports extensions. This means you can install and configure yomichan to be exactly the same as your PC workflow.

Using Kiwi browser requires more config but allows you to use any custom handlebars you may have setup as well as use other incredible tools such as Local Audio Server for Yomichan

To be able to add cards to your anki collection within kiwi browser, you will need to use Anki Connect Android

How to mine manga with kiwi browser and ZXY101's mokuro fork:
  1. Follow these instructions to get get kiwibrowser and yomichan setup if you haven't already. You can skip downloading AnkiconnectAndroid for now.
  2. At the moment you need to use a custom debug version of AnkiconnectAndroid to use the anki connect integration in mokuro. You may need to uninstall AnkiconnectAndroid first to be able to install the debug apk. Once done, download and install the debug apk. The apk contains various fixes and updates to AnkiconnectAndroid that have not been released yet, mokuro's anki connect integration relies on these fixes to work.
  3. In your AnkiconnectAndroid settings, set your CORS Host to *. NOTE: This will allow any website you access to manage your anki collection, if this troubles you - only specify the hostname you wish to have access eg. https://www.mokuro.moe. Unfortunately you can only specify one at a time.
  4. Click start service in AnkiconnectAndroid then open up your manga in kiwi, due to changes with how android handles app storage you may struggle to open local html files in the kiwi browser. This can be resolved by hosting your manga over a http server - you can use something like Simple HTTP Server or Local File Server for Android to host a server directly on your phone. Alternatively you can follow this guide on how to open files locally in kiwi browser.
kiwi

Mining on IOS:

Unfortunately when it comes to IOS you don't have as many options.

You can setup a simple web server to access your processed manga and then use 10ten Japanese Reader for easy lookups.

You won't be able to use anki connect to create your anki cards so you should make sure anki connect integration is disabled in the advanced settings to avoid any errors.


Manga collection:

Processing manga with mokuro requires a decent PC and can take quite a bit of time.

If you have neither the time nor the resources to process manga yourself - you can find a small collection of already processed manga at:

www.mokuro.moe/manga

If you would like to contribute to the collection or make a manga request, see the README inside of the Upload folder.

NOTE: The stability of the site cannot be guaranteed and may occasionally go down, I recommend downloading anything you don't want to lose.

Note about downloading from mokuro.moe:

The manga is shared using hfs, when you download from the site it will automatically zip the files - this can cause issues with unicode file paths.

If the manga you're downloading contains Japanese characters, it will likely garble the file names and the html file will no longer be able to find the images.

To fix this, you can rename the folders to their original names - be sure to copy and past to get the exact characters.

This issue will be resolved in a future version of hfs.