Automated Japanese vocabulary mining from anime subtitles with Anki integration
Project description
Anki Miner
Batch-mines Japanese vocabulary from anime and YouTube into Anki cards. Given a season folder or a YouTube URL, it produces cards containing screenshots, sentence audio, furigana, pitch accent, and frequency data.
Suited to batch processing after viewing, rather than real-time lookup during playback (the asbplayer and Yomitan workflow).
Showcase
Example cards
Generated from video and subtitle files. Each card contains a screenshot, sentence audio, furigana, and definition.
How It Works
- Parse subtitles: tokenize Japanese text with MeCab morphological analysis.
- Filter words: keep content words (nouns, verbs, adjectives, adverbs); drop words already in your Anki collection or on your blacklist.
- Extract media: capture screenshots and audio clips from the video at each subtitle's timestamp via ffmpeg.
- Fetch definitions: look up English definitions from JMdict (offline) or the Jisho API.
- Create cards: batch upload to Anki via AnkiConnect.
Features
- Lapis-compatible cards with furigana, pitch accent, and word frequency fields.
- YouTube support: paste a URL, mine the video.
- Queue a folder of episode/subtitle pairs for sequential processing.
- Offline JMdict dictionary with Jisho API fallback.
- Preview and curate the word list before any cards are created.
- Parallel ffmpeg extraction for screenshots and sentence audio.
- Analytics dashboard with history, undo, and series difficulty rankings.
- Four themes (Light, Dark, Sakura, Tokyo Night) plus custom JSON themes.
Installation
Requirements
- ffmpeg on PATH.
- macOS:
brew install ffmpeg - Ubuntu/Debian:
sudo apt install ffmpeg - Windows: download from ffmpeg.org and add to PATH.
- macOS:
- Anki with the AnkiConnect add-on. In Anki: Tools → Add-ons → Get Add-ons, paste code
2055492159, restart.
Download
Grab the installer for your platform from the latest release:
| Platform | Installer | Portable |
|---|---|---|
| Windows | AnkiMiner-*-Setup.exe |
AnkiMiner-Windows-x86_64.zip |
| Linux (Debian/Ubuntu) | anki-miner_*_amd64.deb |
AnkiMiner-*-Linux-x86_64.AppImage |
| Linux (other) | — | AnkiMiner-Linux-x86_64.tar.gz |
| macOS (Apple Silicon) | — | AnkiMiner-macOS-arm64.tar.gz |
No Python required. Installers and portable archives bundle all dependencies.
Install from PyPI (Python 3.10+)
pipx install anki-miner # or: pip install anki-miner
Install from source
git clone https://github.com/0xzerolight/anki_miner.git
cd anki_miner
pip install .
Quick Start
After installing, launch Anki Miner from your Start Menu, Applications folder, or app menu. If you installed from PyPI or source, run anki_miner_gui from a terminal. A desktop shortcut is created on first launch; re-run it from Tools → Create Desktop Shortcut... inside the app.
Anki must be running with AnkiConnect installed before mining starts.
Tabs:
- Single Episode: mine one video/subtitle pair with file selectors and progress tracking.
- Batch Processing: queue multiple series for sequential processing.
- YouTube: paste a URL, fetch metadata, then mine.
- Analytics: history, series difficulty, milestones.
- Settings: Anki connection, media extraction, dictionary, word filtering. Saved to
~/.anki_miner/gui_config.json.
Recommended Setup
Lapis Note Type
Anki Miner uses the Lapis note type fields by default. For custom note types, rename the fields in Settings/Anki.
- Download the latest
.apkgfrom Lapis releases. - In Anki: File → Import and select the
.apkg.
Default field mapping:
| Anki Miner Field | Note Field | Content |
|---|---|---|
| word | Expression | Dictionary form of the word |
| sentence | Sentence | Original subtitle line |
| definition | MainDefinition | English definitions |
| picture | Picture | Screenshot from the video |
| audio | SentenceAudio | Audio clip of the sentence |
| expression_furigana | ExpressionFurigana | Word with furigana reading |
| sentence_furigana | SentenceFurigana | Sentence with furigana reading |
| pitch_position | (unmapped) | Pitch accent position number |
| pitch_category | (unmapped) | Pitch accent category |
| frequency | (unmapped) | Word frequency rank |
Fields marked (unmapped) have no default Lapis mapping. Map them in Settings if your note type has equivalents. Any note type with the required fields works.
JMdict Offline Dictionary
For fast offline lookups:
mkdir -p ~/.anki_miner
wget -O ~/.anki_miner/JMdict_e.gz http://ftp.edrdg.org/pub/Nihongo/JMdict_e.gz
gunzip ~/.anki_miner/JMdict_e.gz
Without JMdict, lookups fall back to the Jisho API (slower, online, rate-limited).
YouTube Mining
Paste a URL, click Fetch Info to probe metadata (title, duration, subtitle availability), then click Mine. The fetch downloads the video and its Japanese subtitle track into a per-run temporary directory, then passes both files to the same pipeline used for file-based mining.
Auto-captions are accepted only when native Japanese. Tracks that YouTube generates by machine-translating from English are rejected, since mining them yields unusable results. Native auto-captions remain lower quality than manual subtitles because they lack sentence boundaries.
Gotchas:
- Bot-detection prompts: if YouTube asks "Sign in to confirm you're not a bot", open Settings → Cookies → Browser and pick Firefox or Chrome. yt-dlp pulls cookies from that browser's profile on every fetch.
- Age-restricted videos: same fix.
- Max duration: defaults to 120 minutes. The probe aborts before downloading if the video is longer. Adjust in Settings.
Troubleshooting
| Issue | Solution |
|---|---|
| "Cannot connect to Anki" | Start Anki and ensure AnkiConnect is installed. |
| "Deck not found" | Create the deck in Anki or update the deck name in Settings. |
| "Note type not found" | Import Lapis (see above) or configure your own in Settings. |
| "ffmpeg not found" | Install ffmpeg and add it to PATH. |
| "JMdict file not found" | Download to ~/.anki_miner/ (see above) or disable offline dictionary. |
| Audio is wrong language | The tool tries Japanese audio tracks first, then falls back to the default. |
| Subtitles out of sync | Use the subtitle offset control in the GUI. |
Issues, Feature Ideas, Contributing
Report bugs in Issues.
See CONTRIBUTING.md for development setup.
New feature ideas in Discussions.
License
GNU General Public License v3.0. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anki_miner-2.3.2.tar.gz.
File metadata
- Download URL: anki_miner-2.3.2.tar.gz
- Upload date:
- Size: 325.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d4efdcd393b32d822ff8634c37354060087dc714d2cadb5edc976bbe2786a94
|
|
| MD5 |
52e32031a1d0c7d2146e62fdd6463899
|
|
| BLAKE2b-256 |
4fefc8856322c24e6a28a83bc9d037744a1e5d4e6061aa8e747f506c6d228327
|
Provenance
The following attestation bundles were made for anki_miner-2.3.2.tar.gz:
Publisher:
publish.yml on 0xzerolight/anki_miner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
anki_miner-2.3.2.tar.gz -
Subject digest:
3d4efdcd393b32d822ff8634c37354060087dc714d2cadb5edc976bbe2786a94 - Sigstore transparency entry: 1372499677
- Sigstore integration time:
-
Permalink:
0xzerolight/anki_miner@9764e98f3d1dc48c7cc01e94ca1b21b0f7c32f00 -
Branch / Tag:
refs/tags/v2.3.2 - Owner: https://github.com/0xzerolight
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9764e98f3d1dc48c7cc01e94ca1b21b0f7c32f00 -
Trigger Event:
push
-
Statement type:
File details
Details for the file anki_miner-2.3.2-py3-none-any.whl.
File metadata
- Download URL: anki_miner-2.3.2-py3-none-any.whl
- Upload date:
- Size: 372.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe9fbd78f20e8b0466c90362e81a029f2c7f49b12de4339d3259fcc5eee608e0
|
|
| MD5 |
52483edc9330aa9887bfe572cc1ba9d8
|
|
| BLAKE2b-256 |
dd9aeacceace722ee56974aec4854ee28eecd1d0f96a0a216712e5a9443d6b44
|
Provenance
The following attestation bundles were made for anki_miner-2.3.2-py3-none-any.whl:
Publisher:
publish.yml on 0xzerolight/anki_miner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
anki_miner-2.3.2-py3-none-any.whl -
Subject digest:
fe9fbd78f20e8b0466c90362e81a029f2c7f49b12de4339d3259fcc5eee608e0 - Sigstore transparency entry: 1372499807
- Sigstore integration time:
-
Permalink:
0xzerolight/anki_miner@9764e98f3d1dc48c7cc01e94ca1b21b0f7c32f00 -
Branch / Tag:
refs/tags/v2.3.2 - Owner: https://github.com/0xzerolight
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9764e98f3d1dc48c7cc01e94ca1b21b0f7c32f00 -
Trigger Event:
push
-
Statement type: