I’ve searched around this part of forum, and also on TamperMonkey. Is there an API script that will export the WK context sentences?
If you send me an email at kumi@kumirei.com I can reply with a CSV of the sentences
GET /WK-example-sentences.htm HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: @Kumirei
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
import axios from 'axios'
export const wkApi = axios.create({
baseURL: 'https://api.wanikani.com/v2/',
headers: {
Authorization: `Bearer ${process.env.WANIKANI_API_KEY}`
}
})
export async function getVocab () {
const allData: any[] = []
let nextUrl = '/subjects'
while (true) {
const r = await wkApi.get(nextUrl, {
params: {
types: 'vocabulary'
}
})
console.log(r.data.url)
allData.push(
...r.data.data.map((d) => ({
sentences: d.data.context_sentences
}))
)
nextUrl = r.data.pages.next_url || ''
if (!nextUrl) {
break
}
}
return allData
}
Hi,
How do you run that little piece of code?
It would be nice to have those context sentences spoken. tbh, they are still way to difficult for me to read. I do a dance when I can actually read one!
What OS are you using? Do you have a programming language installed?
Furthermore, do you need a sound file, or can you open a browser (you can try this)?
This should work, and you can run with nothing installed.
hi,
I opened the bit you posted on here and in a new chrome tab and it’s not too happy with me!
I’m happy to install anything really. I’d even rather install something! I run win10 and the only installed stuff I have is anaconda with all the data analysis stuff. And R.
Can’t do axios with those.
I’m very curious about all these scripts. I’d like to learn more.
Can you run Python / Requests?
Axios is NodeJS.
You will have to edit Repl.it, if you want to run it.
Oh my, I feel like I derailed this post.
Had a quick look on stackexchange but I’m really unfamiliar with this. I don’t script much in my life!
It defo gets stuck at the axios. I gather I need something extra in there.
Just use the code from repl.it, but you would have to edit this line.
const WANIKANI_API_KEY = ''
I am not giving my key.
About import axios from 'axios'
, it’s a special JavaScript code, that usually cannot be run directly. It needs special compiler, e.g. Babel, tsc. You will have to stick with require()
if you don’t want to install stuff.
Put the wrong number in the first time. It ran this time.
I will look into installing extra stuff.
Tx a lot for spending all this time helping me out. xx
I just installed this and it worked beautifully. Incidentally I tried it on eating natto for breakfast every morning… Never tried natto but can’t say it looks appetising!
I feel like I owe natto a try now.