wanikanify
wanikanify copied to clipboard
Migrate to WaniKani API v2
API v1 will cease to exist on September 1. Therefore Wanikanify needs to migrate to v2 in order to keep functioning from that date on.
The endpoints in v2 are more atomic in nature, so unfortunately it's not quite as easy to use as v1 but I tried to make the code as readable as possible.
- We fetch the user's vocabulary assignments. This gives us the user's progress (i.e. SRS level) for each item, but doesn't provide the vocab itself.
- We fetch the study material. These are all the custom notes and synonyms the user has added to their vocabs.
- Of the data we have requested this far, we are only interested in the user defined synonyms, the SRS level and the assignment's subject IDs. Therefore we create a simple hash that only includes those values.
- Request the subject for each of the user's assignments. This gives us the actual list of characters and meanings.
@padarom Thanks for the PR! I'll have a look and merge in the next few days. I don't use wanikani these days, and I haven't looked at this code in years, except for incoming PRs. It's likely due for an overhaul and/or a new maintainer.
Any update on this? I'd love to continue being able to use this awesome extension.
FYI, Pulled this and ran locally, can confirm change seems to be working (Admittedly Brave Browser) but I can't see why it wouldn't for Chrome.
Yeah, sadly does not appear to be working on chrome. Installed @padarom fork.
I just tested my fork on Chrome again. It is still working for me, even on a different machine than where I developed it. Like AdamMelbye, I don't see any reason why it wouldn't work on Chrome if it worked in Brave. They're all Chromium so if one works, the others most likely also will.
I'm not sure what I'm missing then. Tried a fresh install of Brave Browser as well, and didn't work there either for me. Does the API token need more permissions other than the default "GET"? I downloaded your fork, installed using the developer mode toggle in the extensions tab, put in my API key, and have tried every setting - from the Automatic, to clicking the extension button.
Any ideas, or any form of debugging/logs I can help with?
Edit: Figured out the how to get the console to log stuff. Looks like I'm getting an incomplete promise due to the GET URL being wrong for some reason. Log attached
The difference seems to be our Wanikani progress. The request attaches all subject IDs that you have at your minimum SRS level as GET parameters. For me and wiilover22 this seems fine because we don't have as many subjects, but for you it seems like the parameters make the URL exceed the maximum URL length supported by WaniKani.
Unfortunately I don't have the time right now to look into this, but I assume we'd need to split the request in getVocabListFromWaniKani
into multiple batches so that each request stays under the URL length limit. The issue is that at some point we might run into rate limiting issues, so we'd probably also need to add some smart retry logic and try fetching missing resources over time, which I think is a major change.