I was planning to make or at least experiment with a WaniKani VR application for the HTC Vive.
After having implemented the API I noticed there was no endpoints for reviewing?
All of the API endpoints seems to be only for statistics.
Is there a separate API the mobile application uses for reviews?
Anyone knows how it does it?
Without it the VR application will only be a statistics app -.-
The mobile programs use an embedded iframe, thatās how you can login to it since WK has no authentication linking to it. There is no such API.
Wouldnāt want to experience any level above 20 in VR anywayā¦
Awā¦ I was hoping to do my reviews in a fun way in VR.
Iāll see if I can still do the reviews by using the site in the background but provide a VR GUI to do the reviewing in.
Would have been easier with an API.
Why no kanji above level 20 in VR?
Iāve done RTK 1 twice and canāt see where the issue is?
Of course the writing in VR has to be big for it to be viewable with nice AA/Supersampling.
The potential of what you can do in VR is infinite, I canāt wait to figure out a really fun way to do WaniKani in VR.
Edit: Just checked the review ajax requests and it seems like thatās the API I want to use
Just need to have a session going and it should work.
mattias said... Aw... I was hoping to do my reviews in a fun way in VR.'cuz level twenties are death and thirties are hell... *Badum tsss*
I'll see if I can still do the reviews by using the site in the background but provide a VR GUI to do the reviewing in.
Would have been easier with an API.
Why no kanji above level 20 in VR?
I've done RTK 1 twice and can't see where the issue is?
Of course the writing in VR has to be big for it to be viewable with nice AA/Supersampling.
The potential of what you can do in VR is infinite, I can't wait to figure out a really fun way to do WaniKani in VR.
Haha, WaniKani reviews in VR? Iād like to see what that looks like
Hi there! Iām new here, so please pardon me if I break some sort of rule in this post.
Thereās no public API for that as far as I know, but you could just as well make a GET request to:
https://www.wanikani.com/review/queue?
^ Edit2: this is correct now
You need to pass the userāsĀ _wanikani_session cookie in the request header (ie, Cookie: _wanikani_session=12341243SUPERSECRETNUMBER5325234). Getting the cookie is probably going to be the tricky part, but you could certainly analyze how WaniKani does it and make your own login transaction; not that thatās necessarily very good practice, lol. For the purpose of testing though, you could just pull it out of the Network tools tab in the Chrome developer tools.
Itāll throw you back some JSON which should be fairly intuitive to read out into your own data structure. I canāt give it a proper look yet, because I have only 1 review in my queue, but Iām sure you can figure it out! Good luck BTW, I canāt wait to see WaniKani in VR!!
Edit 3:
It seems that you can make the SRS aware of progress updates via this service:
https://www.wanikani.com/json/progress
You can supply the ID of the item you want to update in the query string; ie:
https://www.wanikani.com/json/progress?r128=0
To assert that the āclamā radical took 0 attempts to answer correctly (I think thatās the point of the 0 there).
Very funny to see this here. Iāve already sent an E-Mail about it, since I wanted to build my own client without the need to disguise as a webbrowser.
Method of logging in:
visit https://www.wanikani.com/loginhttps://www.wanikani.com/json/progress?v18=0 can be called to answer āåā correctly (only works if the item is ready for reviewing)
To get the āauthenticity_tokenā that is inside the login form. (not actually sure if you need that x.x)
And then just send a post with the login informations and the authenticity_token.
Doing so in Firefox gives back a 302 response and ā_wanikani_sessionā is found in the answer header
Doing it outside of firefox gives me back a 200 response and the ā_wanikani_sessionā cookie.
Calling āhttps://www.wanikani.com/vocabulary/åā to retrieve the item ID required for https://www.wanikani.com/json/progress?v18=0 sadly gives me a 500 response.
I havenāt found a different way to get the item ID except for the item pageās javascript
Items that are on your reviewlist can be gathered from the api tho
Here is hopping that Viet at least responses to my E-Mail, but I guess he is a busy man.
Hope I could help someone with my attempt
EDIT: Did I write 301?.. I meanāt 302ā¦
EDIT2: Donāt just copy urls I guessā¦ whoopsā¦
Ah nice, thatās brilliant.Ā
Hm, odd; I get a 200 OK regardless of the item ID. Does it still give you a 500 if you replace that ārā with a āvā? I think thatās supposed to denote the type; ie, for the å vocab word, does this work?
https://www.wanikani.com/json/progress?v18=0
Oh that is what you get if you take the shortcut and copy it. xD
I have ā/json/progress?v18=0&v18=0ā in my code. (as this is what your browser sends after getting it right)
I get the 500 when gathering the Item ID found on the item page:
Line 430 -> https://www.wanikani.com/vocabulary/å: Notes.add(āvocabularyā, āmeaningā, 18, progression.requested_information.meaning_note, $(ā#note-meaningā));Havenāt tried calling progress yet, as it failed on a step before it. I Guess Iāll try it out real quickā¦ and edit the above oneā¦ againā¦
Yeah, Iām just going to create a desktop window which you can login with to get the session.
Then inside VR Iāll make use of this undocumented API.
Kind of how Wevr transport does it.
I guess Iāll start writing on a library to use this undocumented API.
It should be fine since you still need to actually login to use it.
Going to have to write a library for both the public API and the undocumented one before I start on creating VR content.
Haha, you sometime just need to take a little break to see something so obviousā¦
No 401 response with session cookie anywhere
I donāt really want to tell you but okā¦
The reason for the 500 was me sending āåā. (facepalm)
200 with the wanted Item ID after doing some UTF-8 magicā¦
submitting an answer is:
A get to :and you log in with:/json/progress?v<ITEM_ID>=0&v<ITEM_ID>=0With this being in the header. (you get 406 otherwise)X-Requested-With", āXMLHttpRequestāAnd the ā_wanikani_sessionā cookie ofc
A get to :The Item ID can be found on its page inside the javascript near the end of the filehttps://www.wanikani.com/loginand a post with the logindata and the authenticity_token.
And retriving āauthenticity_tokenā from the Loginform
I guess I slept when I tried it firstā¦
Would be nice to so something in the API regardless as less experienced people (like me q.q) get a better chance of doing things
Darky1 said...submitting an answer is:And, of course, replace the zeros with ones if you got meaning or reading wrong. I can't remember which one is meaning and which is reading. It's been a long time since I did anything with those. But I think it's the same order as how it appears on the item progress screen (where it shows percent correct and longest streak).A get to :/json/progress?v<ITEM_ID>[]=0&v<ITEM_ID>[]=0
rfindley said...Totally forgot that.Darky1 said...submitting an answer is:And, of course, replace the zeros with ones if you got meaning or reading wrong. I can't remember which one is meaning and which is reading. It's been a long time since I did anything with those. But I think it's the same order as how it appears on the item progress screen (where it shows percent correct and longest streak).A get to :/json/progress?v<ITEM_ID>[]=0&v<ITEM_ID>[]=0
Something to note would be that the "v" stands for vocab, and is replaced with "k" for Kanji and "r" for Radicals.
My guess would be that the first of the two 0s is the amount of meaning answers you got wrong, and the second one the amount of wrong reading answers.
Radicals have the first 0 changed. (the other one remains 0)
You donāt need to lookup the kanji etc to find the id. All data is available in the queue response:
https://www.wanikani.com/review/queue?
Watching some of the headers I also see X-CSRF-Token, might need that as well?
I havenāt written any code yet. But all you need is to have the network tab open in your browser and do some reviews to find the right api calls and which headers/data they use.
^^^
Iāve done an automated WK login for some scripts that monitor WK updates. Ā I just used wget in a bash shell, with the flag to save cookies to a file. Ā Worked great, and I didnāt have to look at what cookies were being saved. Ā Doing it in an app instead of shell-script should be fine if your http library has decent cookie support.
How do you do login script in Python? What info do I need?
payload = {'user[login]': 'xxxxxx', 'user[password]': 'xxxxxx', 'user[remember_me]' : True, 'authenticity_token' : 'zQE9GfubYgUZdGMlXsnNXzoMbAYBVAKhyIJnhw1TUtB4LAtC/+qExa1/53nhOC9oGTEjz3nU7CkIOPUkoVMaGw==', 'utf8' : '✓' }
For the āutf8ā parameter, I used:
utf8=%E2%9C%93
My overall POST data looked like this (without the new-lines):
utf8=%E2%9C%93
&authenticity_token=ZwqNBZMlyTtJzX3Yw%2BbbxGGX87ScrvxwGCVJd2%2B62bqgNssN6oXlOcpoChWh8nQQMWp9tl5fNMMCjroRg%2Bz9jg%3D%3D
&user%5Blogin%5D=xxxxxx
&user%5Bpassword%5D=xxxxxx
&user%5Bremember_me%5D=0
&user%5Bremember_me%5D=1
And, of course, you have to keep the cookies between calls.
I used a bash script for the fetching, and a node.js script to extract the info from the login page:
bash script
#!/bin/bash
COOKIES="html/cookies.txt"
# Clear cookies
rm -f ${COOKIES}
# Get login page, and extract auth token
wget -Ohtml/login.html --save-cookies ${COOKIES} --keep-session-cookies "https://www.wanikani.com/login" -o/dev/null
post_data=`./extract_login_auth`
# Login, and save Dashboard
wget -Ohtml/dashboard.html --load-cookies ${COOKIES} --keep-session-cookies --save-cookies ${COOKIES} --post-data "${post_data}" "https://www.wanikani.com/login" -o/dev/null
node.js script
#!/usr/bin/js
var username = 'your_username';
var password = 'your_password';
var utf8='utf8=%E2%9C%93';
var fs = require('fs');
var cheerio = require('cheerio');
var page = fs.readFileSync('html/login.html');
var $ = cheerio.load(page);
console.log(
utf8+
'&authenticity_token='+encodeURIComponent($('input[name="authenticity_token"]').val())+
'&'+encodeURIComponent('user[login]')+'='+encodeURIComponent(username)+
'&'+encodeURIComponent('user[password]')+'='+encodeURIComponent(password)+
'&'+encodeURIComponent('user[remember_me]')+'=0'+
'&'+encodeURIComponent('user[remember_me]')+'=1'
);