Skip to content

Setup: Text & Media

Overview

This page is dedicated to providing resources on how to do the following:

  1. Getting the actual text to use Yomitan on.
  2. Getting the pictures and/or sentence audio from the media.

There are plenty of well established resources out there on how to do just that, ranging from software to written & video guides. Instead of repeating what others have already said, those programs and guides will be linked.

If you are looking to setup jp-mining-note, see this page instead.

Note

If you already have a sentence mining workflow, you can likely skip to this section. TODO update link!

Troubleshooting & Support

If you are having troubles with any of the guides or programs below, I unfortunately will not be able to provide very detailed support.

Instead, I would recommend that you contact the creators of the guides / programs, or the communities surrounding said guides / programs.

Additionally, the guides listed here usually do not use JPMN, and instead link to other note types. This shouldn't be an issue as long as you change the appropriate the field names.


Getting the Text to Create the Cards

I use a texthooker setup, which is able to extract subtitles or text into the browser. Once the text is on the browser, you can use Yomitan to select the word and create the Anki card (by clicking on the green plus button).

The standard texthooker setup works for most games, and any show with subtitle files.

Texthooker: Websocket based

These pages display the hooked content, where the hooked content is communicated via Websockets. Websocket based texthookers are better than the classic clipboard-based texthookers in almost every aspect:

  • They are generally faster and more reliable.
  • They do not flood your clipboard.
  • They do not require an extension that constantly polls the clipboard.

However, it requires more specialized coordination between programs. Fortunately, most standard workflows support websockets nowadays.

Resources (click here)
  • Renji's Texthooker Page (recommended)

    • Open source and more featureful alternative to the more popular Anacreon's texthooker page.
    • This texthooker page comes with built in support for both websockets and clipboard inserter plugins.
    • I use these settings to make the text more compressed.
  • exSTATic (recommended for stats lovers)

    • Its primary use is for automatic stats collection and visualizing said statistics.
    • Integrates seamlessly with many workflows, including non-texthooker related workflows.
    • Uses a custom texthooker page, which connects with Textractor with its own custom extension.
    • A video installation guide is available on the project's README page.

Supported Workflows:

Legacy Resources (click here)

These resources are considered legacy, and I highly recommend using the standard resources above in favor of these.

  • Marv's Websocket Userscript

    • A more featureful version of the patch below.
    • Written for Anacreon's texthooker page.
  • Zetta's Custom Patch

    • Patch Instructions for existing clipboard-based texthookers.
    • This patch is intended to be used in conjunction with this Textractor extension.
    • This patch was written for Anacreon's texthooker page. However, it will likely work for most other texthooker pages.
    Instructions to use the patch (click here)

    Warning

    This is a monkey patch, even according to the author. Now that better alternatives have came out (see above), I recommend to use said alternatives.

    1. Download your favorite texthooker page into a raw html file.
    2. Copy/paste the code below to the very end of the raw html file.
    3. If you are currently viewing the page, refresh.

    <script>
      let socket = null;
      let wsStatusElem = null;
    
      const createStatusElem = () => {
        wsStatusElem = document.createElement("span")
        let node = document.getElementById('menu').firstChild
        wsStatusElem.setAttribute("class", "menuitem")
        wsStatusElem.addEventListener('click', (e) => {
          if(wsStatusElem.innerText == "Reconnect") {
            connect()
          }
        })
        node.insertBefore(wsStatusElem, node.firstChild)
      }
    
      const updateStatus = (connected) => {
        if(wsStatusElem === null) { createStatusElem() }
        wsStatusElem.innerText = connected ? "Connected" : "Reconnect"
        wsStatusElem.style.cssText = "margin-right: 1.5em; display: inline-block;"
        wsStatusElem.style.cssText += connected ? "color:rgb(24, 255, 24);" : "color:rgb(255, 24, 24);"
      }
    
      const connect = () => {
        socket = new WebSocket("ws://localhost:6677/")
        socket.onopen = (e) => { updateStatus(true) }
        socket.onclose = (e) => { updateStatus(false) }
        socket.onerror = (e) => { updateStatus(false); console.log(`[error] ${e.message}`) }
        socket.onmessage = (e) => {
          let container = document.getElementById('textlog')
          let textNode = document.createElement("p")
          textNode.innerText = e.data
          document.body.insertBefore(textNode, null)
        }
      }
      connect()
    </script>
    
    (Original discord message, on TMW server. Thanks Zetta#3033 for the code.)

Texthooker: Clipboard based

These pages display the hooked content, where the hooked content is communicated via automated clipboard (copy/paste) tools. Most classic setups documented are for clipboard based texthooker pages. If possible, I highly recommend trying out a websocket based texthooker approach instead.

Resources (click here)
Guides (click here)
Legacy Resources (click here)

These resources are considered legacy, and I highly recommend using the standard resources above in favor of these.


Game-Like Content: Getting Text

The following are primarily for text-heavy games, such as visual novels.

Resources (click here)
  • Textractor (recommended)
  • agent
    • This is a good fallback for when Textractor doesn't work
Guides (click here)

Video Content: Getting Text, Sentence Audio, Picture

Video content includes streamed content (Youtube, Netflix, etc.) and locally downloaded files.

Resources (click here)
  • mpvacious (recommended for downloaded videos / if you are using mpv)
    • Add-on for mpv, a cross platform media player. Personally tested.
    • Basically universal codec support since it uses mpv.
    • This addon has capabilities to extract the video clip itself as the form of a gif (autoplayable webp).
    • See here for basic setup instructions.
  • asbplayer (recommended for streamed sites)
    • Cross platform (chromium) browser video player. Personally tested.
    • Works on video streaming sites, as well as downloaded videos.
    • Does not require a texthooker page: subtitles are displayed on the site itself.
    • Codec support is limited, and depends on the browser used.
    • See here for basic setup instructions.
  • Animebook
    • Cross platform (chromium) browser video player.
    • Does not require a texthooker page: subtitles are displayed on the site itself.
    • Codec support is limited, and depends on the browser used.
    • See Cade's sentence mining guide for basic setup instructions. Note that the aformentioned guide is not using JPMN.
  • All of the above require subtitle files to function. See here and/or here for some websites where you can get subtitles from.
  • One challenge for video content is that subtitles are usually not aligned properly if the subtitles are downloaded separately from the video. I've always used a combination of mkvextract (to extract the subtitle file from the .mkv file) and alass (to align the native subtitles with reference subtitles, usually in a different language) to get the job done. If you want more options, see this page.

Other:

  • jidoujisho
    • Android e-book reader and media player. Advertises itself as an all-in-one app.
  • Immersive
    • Add-on for MPV. Alternative to mpvacious.
    • WARNING: This is potentially outdated and/or abandoned. The most recent commit as of writing (2022/10/19) was done in 2022/01/27. This is listed here for completeness only.

Manga: Getting Text

mokuro (recommended)

mokuro pre-processes manga, so you don't have to run any OCR program afterwards.

Guides:

  • Lazy guide (recommended)
    • (For Windows users) Make sure to check the "Add Python to Path" on install.
    • If you are using online processing (google colab), be sure that you are using the gpu to speed up the process.
  • Josuke's mokuro setup guide
    • Contact info: Josuke#7212 on the Refold (JP) Discord server
    • This doesn't include instructions on how to process online (whereas the Lazy guide does)

Other Resources:

If any error occurs, check the following:

  • Check your Python version (python --version, or python3 --version). Python 3.10 is not supported yet.

    If your Python version is too old, I recommend using pyenv (for Linux users). Linux users can use the automatic installer. For Windows users, it should be sufficient to uninstall mokuro, install a newer version of Python, and then re-install mokuro with the newer version.

  • Make sure your directory is a string and not a number. For example, mokuro ./01 on unix, and mokuro .\01 on Windows.

Manga OCR

Manga OCR allows you to automatically OCR any image. As the name suggests, this works best on manga.

Guides:


Books (EPUBs, HTMLZ, PDF)

As long as you're not using a scan (image-based), the text should already be available. Below will list a few ways to view these files in a browser to Yomitan.

Resources (click here)

Other:

Guides (click here)

Audio/Video with No Subtitles

KanjiEater's AudiobookTextSync is a relatively new set of tools that generates subtitles using machine learned models.


Getting Images & Sentence Audio Manually

Sometimes, there is no easy way to get the image and sentence audio other than with a screen recorder. The primary example for this is game-like content.

Here are the two popular approaches to automatically adding the image and sentence audio:

ShareX (Windows)

ShareX

  • Windows media recorder which can both take screenshots and record audio. Personally tested.

Guides:

ames (Linux)

ames

  • ShareX alternative for Linux. Personally tested.
  • Primarily used to automate audio and picture extraction to the most recently added Anki card.

Resource Lists

Other websites have significantly larger resource lists that may prove useful for you.

Resource Lists (click here)

Last update: May 15, 2024