Daijirin Dictionary Scraper

AnkiWeb addon 311119199

Scrapes monolingual Japanese definitions from Daijirin and Weblio Wikipedia for insertion into selected Anki note fields, with search and add shortcuts.
AI-generated summary; may contain mistakes.

card-creationdictionary

Open on AnkiWeb GitHub Find alternatives

AnkiWeb

Votes
4 (πŸ‘ 4 Β· πŸ‘Ž 0)
Updated
2020-03-22
Anki versions
unknown
License
AGPL-3.0 (from the GitHub repository)
Virus scan
No ClamAV match A match does not prove malware. No match does not prove that the code is safe.
Languages
Python, JavaScript
Description language
en

Maintenance

abandoned

  • Last update or commit: 2020-03-22 (2415 days before the snapshot).
  • Commits in the last year: 0.
  • Issues: 0 open, 1 closed.
  • Pull requests: 0 open, 0 merged.
  • Median first response: 261 hours (1 answered issues and pull requests).

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.0–2020-03-22
History across monthly snapshots

Loading…

Similar addons

Nihongo Companion

Adds Japanese example sentences to decks and provides kanji statistics, using NihongoMaster, Massif, and Monash sentence-bank dictionaries.

card-creationstatisticsdictionarybeta

1 votes 21% approval πŸ‘ 1 Β· πŸ‘Ž 0 ⭐ 2 Anki 2.1.52~ Updated 2022-04-12
Japanese popup dictionary

Provides instant hotkey-activated Japanese dictionary popups in Anki's reviewer and editor, showing definitions, pitch accents, and frequency with deinflection, customizable themes, and local SQLite caching.

shortcutsappearancedictionary

3 votes 44% approval πŸ‘ 3 Β· πŸ‘Ž 0 Anki 25.09.2~ Updated 2026-05-11
JPDB Anki Importer

Imports JPDB Japanese word review history into Anki, including spelling, reading, and simulated answer history, with optional scraped definitions, custom sentences, and notes.

card-creationimportscheduling

4 votes 51% approval πŸ‘ 4 Β· πŸ‘Ž 0 ⭐ 16 Anki 24.11~ Updated 2025-02-27

Description

LATEST UPDATE: v20200322 (March 22, 2020) Now supports scraping weblio's Wikipedia definitions as well! It is also my first addon, so help is welcome. See the repo for the addon here. Purpose: to automatically grab monolingual Japanese definitions from the ε€§θΎžζž— (daijirin) dictionary for adding to notes. As an AJATT learner, I always liked having my definitions on my cards, so I figured it would be best to just have an addon do it for me. Usage:
  1. Download addon and restart Anki
  2. Open an editor window
  3. Click on a field where you would like to add a definition
  4. Click the addon icon in the top right
  5. Enter a term in the search bar, press the search (怜紒) button, and wait for the scraper to grab the definition
  6. You should see it appear in the larger box below the search bar
  7. If you need more definitions, repeat step 5 until you have all the desired definitions for your card
  8. Press the add (追加) button to insert the definitions you grabbed to the note field you selected in step 3
  9. Win!
Shortcuts in the addon window:
  • Enter: search for a definition
  • Ctrl + Enter: add definitions to note field

README

Daijirin Scraper | ε€§θΎžζž— スクレーパー

Purpose of this addon

To scrape dictionary definition data from weblio.jp for definitions from the all-wonderful δΈ‰ηœε ‚ ε€§θΎžζž— (Daijirin), a Japanese dictionary. It then parses the proper HTML to be injected into note fields. A template is included in the file daijirin-scraper-example-card-layout.apkg, which you can double click and import directly into Anki (desktop version).

Goals for this project

This is my first Python project. The goal was to learn more of the Anki codebase and automate a time-consuming process of adding definitions to cards.

NOTE: this add-on currently supports single-level list definitions only

It will not support multi-level nested definitions. At that point, I think you would be doing yourself a disservice listing out an entire definition on a flash card. Also, with Weblio's archaic HTML structure, the means by which creating something that could extract multi-level nests would not be an efficient effort, and I need to focus my time and energy on other things (like studying Japanese and building more tools to help people learn languages). If someone would like to implement this feature, I am open to contributions.

If you need to reference a word with a lengthy multi-nested list of definitions, I would suggest finding the one or two specific definitions and copy-pasting them from the website.

Anki Addon version

Click here to go to the shared addon page.

Usage

  • With the Anki main window open, go to Tools > Addons or type Ctrl + Shift + A
  • Click on the Get Add-ons... button
  • Copy and paste the following code into your Anki addons dialog: 311119199
  • Click Ok, wait for Daijirin Dictionary Scraper to appear on the addons list, close the window and restart Anki.
  • At the main window click Add or type A to open an editor dialogue. You will see a small green book button in the top right row of editor icons. Click it to begin using.

Standalone CLI version

This project began as a command line script. The script adds the definitions to a text file (definitions.txt) which could be copied to clipboard and pasted into Anki.

Dependencies, required modules, etc.

  • Python v3.6+
  • bs4 (Beautiful Soup v4)
  • requests
  • sys
  • os
  • pyperclip

After Python and pip are installed, you can get the additional non-standard packages by running:

pip install -r requirements.txt

from this project's directory.

Usage

I suggest using Git Bash or some other bash terminal emulator on Windows.

To run the script and add a definitions to the text file, run the following command.

/path/to/python.exe /path/to/daijirin_scraper.py 言葉

(言葉 can obviously be replaced with any term you would like to try)

You can alternatively make an alias as a shortcut for running the script like this:

alias daijirin="/path/to/python(.exe) /path/to/daijirin_scraper.py $1" 

Then you could just run it like this

daijirin 言葉

instead of this

/path/to/python(.exe) /path/to/daijirin_scraper.py 言葉

If the entered term was found, it will be printed to the console along with the definitions and added to definitions.txt. If the term could not be found, an error will print stating that no terms matched. In some cases you might need to search for the term manually on weblio.jp.

You can view your stored definitions with:

daijirin list

Once you have the desired defnitions in definitions.txt, you can run:

daijirin cut

This will cut the definitions from the text file into your clipboard so you can paste into your Anki card fields. After running this command, definitions.txt will be empty so that it is ready when you want to use it next.

If you want to clear the definitions.txt file without copying them due to a mistake or otherwise, you can run:

daijirin clear

Handling Japanese text on the command line

Your command line program will require a font with Japanese glyphs. I suggest OsakaMono. Also you will need to set your PYTHONIOENCODING variable to UTF-8 as well by running

export PYTHONIOENCODING=utf-8

If you are using Hyper, you will need the following inside your preferences file (.hyper.js):

env: {
      LANG: 'en_US.UTF-8'
},

You may obviously have other properties alongside LANG inside of env, but LANG is needed for this application.

Consult Google for help with changing your terminal font :)