Anki add-on: Jap-jap definition scraper from weblio with auto-formatting

An Anki add-on that automatically fetches and formats Japanese-Japanese definitions from weblio.jp . This add-on is intended for users who already know a fair amount of japanese and who create their own cards with japanese-japanese definitions. Usage: The note type should include "Japanese" in the name and, in addition, have the following two fields : Words: this is the field where you input the words whose definitions you want, separated with Japanese commas 、(i.e. the commas typed when using Japanese mode) Meaning: this is the target field. As long as this field is empty, exiting the Words field will fill this field with the definitions scraped from weblio Example: Consider the sentence in the Expression field below, which is a description of the pokemon Kadabra (ユンゲラー in Japanese). Looking at this sentence, suppose you want to learn the meaning of the words 頭痛、起こす、精神力. You then input those words into the Words field (separated by Japanese commas 、). Then, once you click outside of the words field, the add-on will automatically fetch the definitions from weblio and, after a few seconds, return the following. Notes : For words with multiple separate definitions, such as 頭痛, the add-on will return multiple entries For words with multiple sub-definitions, or even sub-sub-definitions, such as 起こす, the add-on will return those sub-definitions and sub-sub-definitions appropriately indented. For instance, in the above sub-definition ① of 起こす has sub-sub-definitions ㋐㋑. In fact, this will work even in some rare cases where there are sub-sub-sub-definitions. To limit the number of definitions returned, for words with more than 3 sub-definitions only the first 3 sub-definitions will be returned. The add-on will try to find the reading of the word and display it in brackets [] at the beginning. The add-on will fill any examples in the definitions to include the word (as opposed to the weblio convention of leaving the word implicit as "-"). Bugs : Unfortunately, the code and formatting of the definitions on the weblio website can be somewhat inconsistent, so it is quite likely that you will at some point run into definitions whose format is not 100% correct, especially for older definitions (e.g. any word which has the reading listed after 読み方). If you find any such examples please let me know so I can improve the add-on. That said, I believe the add-on currently works as intended on a good majority of definitions. Updates : (13/10/2020) A few days ago the code on the weblio.jp website received significant revisions that caused the formatter function of the add-on to stop working. This function will need to be fully rewritten, but for now I've updated the add-on with a very quick fix so that it at least works. I'll be further rewriting the add-on code over the next few days (the good news are that the html on weblio.jp seems to have become much more uniform, so this rewrite will hopefully be much easier than writing the add-on the first time around) (31/10/2020) The code for formatting definitions has been partially rewritten to work with the new code on weblio.jp , so the format of definitions should now be cleaner

GitHub repository: dendroidal/jap-jap-definition-scraper-from-weblio--anki-add-on-
Repository description: An Anki add-on to automatically fetch japanese word definitions from weblio.com and auto-format them.　https://ankiweb.net/shared/info/1591861881
Languages: Python