themoeway / yomitan

Japanese pop-up dictionary browser extension. Successor to Yomichan.
https://chromewebstore.google.com/detail/yomitan/likgccmbimhjbgkjambclfkhldnlhbnn
GNU General Public License v3.0
977 stars 74 forks source link

Simple Web API #522

Open donkuri opened 6 months ago

donkuri commented 6 months ago

Reposting from #45:

Is there any interest from the devs to implement some variations of this Yomichan issue) at some point in Yomitan? The reason I am asking is because I would be very interested in writing an app that "pre-mines" HTML pages open in a web browser to create Anki decks out of them, like JPDB does. The idea would be that Yomichan scans a document and parses it (I think Yomichan uses mecab? not sure) and automatically adds every new word to an Anki deck, using the user's handlebars and decks. Is this idea at all feasible or should I forget about it?

toasted-nutbread commented 6 months ago

The idea is feasible, yes, and I did put some effort into looking into this and some very brief design, which I never fully implemented. But basically the idea was to allow the user to set up API keys which are permitted for specific origins, and on those origins, Yomichan would respond to some sort of generic event on the document.

https://github.com/toasted-nutbread/yomichan/commits/api-keys/

There is nothing significantly difficult about this, it just adds some more stuff that needs to be saved in the settings, and thus UI to go with it, which I never finished. It would just be a matter of properly exposing the API functions that you, or others, would want.

I think one of the other potential difficulties I was thinking about was customizability of what type of data the API returns or adds to Anki, since this is largely based on your current settings. For example, the templates that are used come from the user's settings, but what if someone wanted to use the API to provide specific settings values for everything, up to and including a custom template string? Currently this is not directly possible, but it could be added in the future.

Overall, this ask is probably easier to accomplish now that the project has full type annotations.

donkuri commented 6 months ago

That is very encouraging, I see a lot of work has already been done. Maybe it is time for me to learn web development and Javascript.

Concretely speaking, what is there left to do to implement the basic version of this? Would you be interested in picking this back up at some point?

tchin25 commented 1 month ago

I'm the original creator of that issue. Is anyone working on this? I wouldn't mind looking into this myself