Vocab list (separated by ',') generator -- add reading and meaning

Jisho doesn’t have a kanji API. They’ve talked about adding one, but honestly, there’s been almost zero development on the API over the last two years.

1 Like

You could add a URL parameter “?proxy=xxxxxxx”:

var proxy = decodeURIComponent((location.search.match(/\bproxy=([^&]*)/)[1] || ''));

Unfortunately I understand zero js. :smile: Don’t even know where I’d put that or what’d it do.

Just replace:

var proxy = 'https://crossorigin.me/';

in polv’s script with:

var proxy = decodeURIComponent((location.search.match(/\bproxy=([^&]*)/)[1] || ''));

Then, if someone adds a proxy to the URL, it will use it automatically:

Alright. I edited it.

It’s still not working right though. That must have been some other change. @polv

Looks like that proxy is having problems. This one is working for me:

What are the benefits of using a proxy?

Jisho API does not allow non-proxy version (allowed if not uploaded to a server, though.)

I updated the link in the OP.

Ahhh… makes sense.

A more detailed answer, if you’re interested:

There’s something called CORS (Cross Origin Resource Sharing), where a server (e.g. jisho.org) adds a header to their files essentially saying “this file is intended to run on the following sites”. The browser then checks if the site that’s requesting the resource is on that list. If not, the browser blocks it from running.

Since jisho.org doesn’t specify a list, most browsers default to not allowing it.

The proxy acts as a middle-man, adding your site to the list (or in this case, creating the list), so your browser will accept it.

Apparently, Safari doesn’t care about the CORS list, so it doesn’t need a proxy. But almost all other browsers these days do.

There’s been an outstanding request on the jisho forums for about 2yrs to add a CORS header, but it doesn’t look like they’re doing any development on the jisho API.


I feel like this holds the answer, but my brain was only 85% of the way there before it fizzled out. Thoughts?


For fun, I’ve been playing around with this while waiting for unrelated things to compile:


  • Paste your list, and it will automatically start converting.
  • It detects connection errors and retries.
  • It requests only 3 items at a time to reduce flooding the server with simultaneous queries.
  • The output window updates as each item arrives from Jisho.
  • It removes each input word as it’s processed, which serves as sort of a visual progress indicator.
  • It searches through the various dictionary entries returned by Jisho to make sure it’s grabbing the exact match (if there is one).
  • It searches the available readings for the word to make sure it’s grabbing a reading that matches the particular ‘word’ entry (i.e. so it’s not grabbing a reading from an alternate kanji spelling)

If you’d prefer not to do the autostart upon paste, I can add a button back in. It was just easier during development to have it autostart.

I was actually thinking about it autoconvert… pretty sweet. I also like how it resizes now. Let me test some stuff. I seem to be having some trouble with it outputting anything.

It does not seem to like spaces. But if I post a list like
It worked perfectly.

It also would not accept them if they were separated on different lines.

Since polv is copying from the stats site, the copied text is automatically comma-separated.
Nonetheless, I’ve now added ability to parse newlines, spaces, and tabs as well.

I’ve moved the autoconvert to a url parameter: convert=auto

That way, by default, it lets you edit the list all you want before you click convert.

1 Like

By the way… I hope we’re not getting too carried away with this. I see it as a fun programming problem, and today I have a few spare minutes scattered through the day while waiting for things to compile.

It works pretty fantastically. Cool cool cool.


BTW, if I put uncleaned things in, it becomes

Level	-----	-----
(0	-----	-----
42	-----	-----
shown)	-----	-----
Level	-----	-----
2:	-----	-----
(0	-----	-----
90	-----	-----
shown)	-----	-----
Level	-----	-----
3:	-----	-----
(0	-----	-----
Level	-----	-----
shown)	-----	-----
72	-----	-----
shown)	-----	-----
106	-----	-----
(1	-----	-----
年中	ねんじゅう	whole year; all year round; throughout the year
Level	-----	-----
(2	-----	-----
126	-----	-----
shown)	-----	-----
何日	なんにち	what day
生える	はえる	to grow; to spring up; to sprout
Level	-----	-----
118	-----	-----
shown)	-----	-----
金星	きんせい	Venus (planet)
(1	-----	-----
Level	-----	-----
100	-----	-----
(2	-----	-----
shown)	-----	-----
形	かたち	form; shape; figure
末	すえ	tip; top

Which doesn’t really matter, anyway.

This one has the button.


Fixed. Now you can paste directly what you copy from the stats page.

I also adjusted the tab size and word wrapping, so the output looks cleaner:


So pretty…