[Unsupported] Dashboard Userscript: Leech, Apprentice, and Guru detail (aka SRS level progress)

I moved to the stats to a separate topic: Leech Statistics.

1 Like

The script itself is neat, I just have one tiny complaint…

Could you please prompt the user before logging them in with their API key into your site?
You seem to be storing the keys in a serverside database, because after deleting cookies one is still logged in.

I do not mind personally, but simply transfering the API key without a notice is kinda shady if you ask me.

Thanks for bringing this up, @valeth. I don’t think this is at all shady. So I want to go a lot deeper into the topic than you intended, to explain why. This is partly because it has also been a topic that’s been on my mind.

The brief answer is that I feel I have everyone’s best interests at heart. I’ve written a web site that uses your api key because it makes lots of scripts possible that wouldn’t otherwise be feasible. Because of this there are a number of places an api key ends up by having a script I’ve written active. So here’s the full list:

  • In a browser cookie associated with wanikanitools-golang.curiousattemptbunny.com. You can clear cookies for that site to get rid of it, or use the sign out button on the site.
  • In an analytics tool that I use, called New Relic. Data is discarded there after two weeks (or possible one week, I forget). This is not essential, it’s just easier for me to support people when someone says the script is broken for them but it’s working for me.
  • As the index into caches of assignments, review_statistics, study_materials from the WK site. This is what makes the site so fast at computing leeches etc. This data is currently never deleted (because disk space isn’t a problem). I could either put the effort in to making them expire, or into converting the api key a one-way hash.
  • In my web server logs. This is pretty ephemeral although I’m not sure how quickly the logs are deleted.
  • Specifically for the App Store script: I’m using the api key to track which scripts the user has installed. Again, I could put the work in to use a one-way hash here.
  • Specifically for the Leech Trainer script: I’m using the api key to track which leeches have already been trained. Again, I could put the work in to use a one-way hash here.

I’d like to frame things this way:

  • Installing any user script relies heavily on trusting the author of that script. It’s essentially running arbitrary code which could do anything that JavaScript running on a web site can do.
  • All the code I write is publicly visible - either on greasyfork, or in GitHub.
  • I’m motivated to make my own experience of learning Japanese on WaniKani the best that it can be, and it delights me that others get to benefit from my efforts too. A post like this really makes my day, and affirms that I’m on the right track.
  • I easily volunteer 5 (often more) hours of my own coding time a week on the collection of scripts that I’m writing and maintaining. I have a busy life as a parent, spouse, and employee, so these hours come from a small and precious supply. All that is to say that I’m very deliberate about which features I add. I’m always looking for what gets the best making-the-most-peoples-learning-better to my-time ratio.

So to summarize, I think it boils down to:

  • Ideally, everything is good as-is, or
  • If there are one or two requests to delete api key information, I’ll do them by hand., or
  • If there are multiple requests, I’ll be motivated to either provide an iTunes-like “Agree to Terms” warning (which I personally dislike), or more likely implement a delete-all-my-data button.

Again, thanks for bringing up the topic. I hope this doesn’t come across as me picking on you, because my intention is just to be transparent about how I’m using your api key and what my motivations are.



Sorry, I didn’t want it to come of as harsh as it probably did.

I’m not against storing the keys or user data per se.
Just a bit concerned if this is covered by WK’s TOS about using an user’s API key and especially user data.

I heard that they will clarify soon what can and can’t be done with the data retrieved through the API (probably when APIv2 is more stable).

1 Like

I’m getting slightly annoyed here.

I completely disabled (and even uninstalled) your userscript, cleared my caches/storage/cookies, but the leech indicator is still showing up.

Any idea why this is happening?

Screenshot with the indicators still showing up after disabling the script:

Btw: The Appstore menu option seems to refuse to vanish as well (script is also disabled and uninstalled).

I also explicitly logged out with the logout button on your site.

I don’t know anything about this particular script, but did you originally install it without a script manager (e.g. TamperMonkey) installed? If so, you may have a copy installed directly in the browser extensions.

I installed via Tampermonkey for Firefox.

If I disable Tampermonkey completely, the indicators are gone until I turn it on again.

Even if I delete the node in the inspector, it gets inserted again when reloading the page.

Alright, reinstalled Tampermonkey completely now with every script I was using.
It seems to be fixed now… for now at least.

1 Like

Is this script working properly for people currently or are we still having issues?

My issue is my apprentice count is off, but guru appears to be correct.


I quickly scrolled through the thread so maybe I missed discussion regarding this, sorry.

Is there an update I missed?

Edit : I uninstalled and reinstalled but no change. It still appears to think I have an extra item in Apprentice lv 2.

Yes I just checked, the sum is also 1 off in my case. 176 would be correct but the details show “11/23/62/81” which would sum up to 177 instead. In my case lv 4 is slighlty off and should be 80 instead of 81.

Not that I would care (or would have noticed) because it is too many damn Apprentice items either way but yeah, seems to be a general mini bug.

It’s just odd because it used to be accurate so idk what changed.

My numbers have been frozen for ~ a week now.

Website troubles OP?

@Ryouki @irrelephant @alexlf
Hmm. I don’t see anything unusual on the server-side. What you see on your JavaScript Console when you load the dashboard page?
I’d expect to see a line like this:

v2 api_key is xxxxxxxxx

and then no errors showing up in red.

Can you direct message me what shows up? (Here’s how to get to it).

1 Like

EDIT: NVM, DMed. Not sure how sensitive the API key is.

1 Like

I can send you my API key via PM if I find out how to do that or I could tell you that it looks like this: a857**…**d62c. What is off for me is always apprentice level 4 which is one item larger that other scripts show it (currently 105 instead of 104).

So far I can say that it is not a display issue in the script but the data is already wrong in srs-level-progress-cache but that was probably obvious to you anyway.

I noticed that you are using the v2 API key. Maybe it is not an issue with your script but maybe the other scripts are using the v1 API and it is a WaniKani API issue, nothing related to your scripts? But I’m just making random guesses. => no that’s not it, I fetched the results from the API directly, they are correct.

My numbers have been frozen for ~ a week now.

I don’t have that issue. They are being updated, they are just consistently off by 1.

Let me know if I can debug something that would help. I obviously really don’t feel like doing my reviews atm. :wink:

Thanks hitechbunny! The latest fix is causing my numbers to update again.

Mine is still off. I still have an item stuck in the second second level of Apprentice. I know this because I took a break from lessons and got to 0 Apprentice items and it still showed a 1 in the second level and there is always one more in that level than there should be.

All other numbers are moving along accordingly.

@hitechbunny I have a mini feature request. Sometimes I calculate how many extra reviews a day I’m getting on average because of my leeches. It’s a really easy calculation (just the sum of number of leeches / interval in days for each SRS level), but it would be nice if the script would quantify that automatically. What do you think?

Could someone help me understand how the scores for the leeches work? I’m assuming that a higher score is worse but not sure (?).

I’ve tried to follow the discussion but I got quite lost to be honest… Furthermore, how is this leeches list different than the critical items list?

Thanks in advance!

@dbuendia, the higher the leech score, the worse the leech.

Leech was a term coined by other Wanikani members to indicate items which we keep getting wrong. In real life a leech sucks blood from your body. Wanikani leeches suck time from our lives.

Leech scores are based on a formula which compares how many times you got reading (or a meaning) wrong with the current streak of correct answers. e.g. If you have had four in a row correct, then you’re doing pretty well with that item and it gets a lower leech score.

I understand the current formula for leech score is:

number of times incorrect / (current correct streak)^1.5

A score >= 1.0 is considered to be a leech. The higher the leech score, the more difficult it is to memorise.

How does leech score differ from critical items?

Leech score has finer detail. It looks at your performance in getting the reading and meaning correct separately. You might be really good at getting the meaning but always getting the reading wrong. You need to be able to identify that item as a leech.

Critical items is a much simpler formula.

number of times correct / number of times reviewed

Then meaning and reading scores are combined.

Some of us have found the critical items list to not be helpful. A good performance in meaning might obscure a poor performance with reading. Such items may never show up in your critical items list.


That was really helpful. Thank you @wunderbunny!