Jisho

×
313dce98dff1a60604410ca3164e2778
62 Replies ・ Started by gcr at 2015-03-10 14:13:51 UTC ・ Last reply by Kimtaro Admin at 2017-01-09 18:50:44 UTC

Is there any kind of search API?

Hello!

I'm thinking of writing a plugin for emacs to quickly look up words. Is there any kind of HTTP JSON API for Jisho? Should I screenscrape the results page?

Also, are there any API rate limits? Nobody uses emacs so I hope this won't be a big server load.

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-03-12 18:37:27 UTC

There wasn't :)

I want to have a properly documented and well functioning API that people can use to search Jisho with. Since a lot of people have been asking for this I started working on something simple to get started.

I wasn't going to mention it publicly until it was more finalized, but now I think it's just better to show it off and get feedback.

So, here's the word search API: http://beta.jisho.org/api/v1/search/words?keyword=house

It's very simple, there's no documentation and I'll probably change the format and add some kind of rate limit later down the line.

See it as an alpha inside a beta :)

313dce98dff1a60604410ca3164e2778
gcr at 2015-03-13 22:57:33 UTC

:O! THANK YOU!

You have NO idea how happy I am. This is perfect! I can't wait until after my paper deadline to sit down and play with this!

7af5350934690c015ab7afe3b6f86438
shred at 2015-03-14 20:00:11 UTC

Thank you! I am learning Japanese. This API will help me convert a vocabulary list of verbs from the -masu form to the -ru form. It would have taken me hours by hand.

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-03-14 21:02:46 UTC

Cool, glad it'll be useful! Let me know if you run into any issues with it.

F68b8c055a10647cdbd73cb0313a9563
fasihsignal at 2015-03-15 05:13:04 UTC

+1! This is the kind of thing worth tweeting :D!

7af5350934690c015ab7afe3b6f86438
shred at 2015-03-15 09:56:41 UTC

Maybe just one idea... Could you add the Hepburn notation to the result? E.g. {"word":"食べる","reading":"たべる","hepburn":"taberu"}

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-03-15 14:05:26 UTC

@shred, good idea, I'll make a note to add romaji to the output.

07321d1e8fdb3efbd6297953a3bbe569
Nyanko at 2015-04-22 17:19:48 UTC

Any chance that we can use the API to include search tags?

07321d1e8fdb3efbd6297953a3bbe569
Nyanko at 2015-04-30 22:10:19 UTC

@Kimtaro?

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-04-30 22:51:37 UTC

@Nyanko I'm not sure what you mean. Can you give an example of an API search that doesn't do what you expect it to?

07321d1e8fdb3efbd6297953a3bbe569
Nyanko at 2015-05-01 09:12:44 UTC

@Kimtaro: When I understand it correct, than you use the search API like this: http://beta.jisho.org/api/v1/search/words?keyword=house

But how do I use the API to, for example, search for all words that are tagged with #jlpt-n5? What do I need to write into the GET parameters?

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-05-01 10:05:24 UTC

@Nyanko, this will work: http://jisho.org/api/v1/search/words?keyword=%23jlpt-n5

But the tag isn't exposed in the API output yet. At some point I hope to put some extended work into making the API great, but I have to concentrate on fixing initial issues with the website first.

65ecdf18e50934634898dd3eaa310a69
octref at 2015-05-04 21:04:53 UTC

@Kimtaro

Thank you for your hard work :-)
Actually I'm planning to make a Chrome extension for jisho.org to better integrate it into Chrome.
I'm not in a hurry, but is there any way that I can sign up to get notified when you release the API?

07321d1e8fdb3efbd6297953a3bbe569
Nyanko at 2015-05-05 21:13:56 UTC

@Kimtaro, is the API output limited or is it printing all JLPT N5 words? Because it doesn't seem like it with the json from your link above.

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-05-09 14:07:34 UTC

@octref that sounds great :) There's no signup to get notified when the API is more expanded. But when that happens I will post about it in the forum and make appropriate documentation pages.

@Nyanko It's working correctly, it's just not including the JLPT tags in the output at this point. There's also no indication of pagination, but you can use page=2, page=3 etc to paginate the output. This will all be included once I do proper work on the API.

34eff5febee24d4c175be53778ac6400
StarScape at 2015-05-12 13:41:21 UTC

This is awesome! Thank you SO much. I've been searching for an API-able Japanese dictionary forever, but there's just not that much demand for Japanese learners who want to build Anki decks with scripts or write their own learning aids. I'd actually tried to scrape straight off the html before, but I suck at parsing and the page layout was complicated so I just gave up.

This, however, is awesome. Keep up the good work.

34eff5febee24d4c175be53778ac6400
StarScape at 2015-05-12 13:54:21 UTC

Any chance of adding inflections to the API? E.g. here it would be cool if it could tell you that it's the polite form of the verb(you'd probably already know that, but just an example). In other words, just the contents of the inflection box.

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-05-18 17:46:16 UTC

@StarScape Yes, I could probably add that when I put some more work into the API. Might make that a separate call though. We'll see.

65ecdf18e50934634898dd3eaa310a69
octref at 2015-05-22 02:26:40 UTC

@Kimtaro
Can you create a repo for the API on github?
This way I and other people interested in the API could "watch" it to get notified when you make changes to it.

I don't know how you plan to write the doc yet, but I recommend writing it as a Markdown and put it on github.

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-05-23 14:44:20 UTC

@octref, a GitHub repo for the API docs is a good idea. I've created one here for now: https://github.com/Jisho-org/API-docs

65ecdf18e50934634898dd3eaa310a69
octref at 2015-05-24 15:38:22 UTC

@Kimtaro Thanks!

81086a2e23d9d6ee05c31c9848c4b536
NessDan at 2015-05-30 16:52:10 UTC

So I'm working on a script that would take advantage of Jisho's API, but I can't make requests due to a lack of Access-Control-Allow-Origin headers :(

Is this something that could be added? Really excited to make this thing and share it!

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-06-02 23:29:47 UTC

@NessDan, good point. I'll make a todo to allow cross domain requests in the API.

006585bb6ed48bbec160bc71436a3300
xtreme1 at 2015-08-30 21:30:44 UTC

Is there any way to access the kanji data with the api?

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-09-02 22:57:33 UTC

@xtreme, not yet, sorry.

471bdaaf1e6109109c51730b7406b3b3
cjx3711 at 2015-09-27 17:02:53 UTC

@NessDan I was trying to use the api in a Web app of mine as well, but has the same cross domain error. But I managed to work around it by creating a proxy that could reside on my host but called this api.

81086a2e23d9d6ee05c31c9848c4b536
NessDan at 2015-10-06 19:44:13 UTC

@cjx3711 My solution as well! http://blog.javascripting.com/2015/01/17/dont-hassle-with-cors/

I modified that a bit and called a proxy function during the requests that did the translating for me.

I ended up converting my script to be fully node.js and that also seemed to fix my issues :)

2d77d29d989db1127f4211581d4ad448
NeedleOrchard12 at 2015-11-16 17:51:32 UTC

I tried pulling a few words from this and it seems like the example sentences aren't included in the data. Is there a way to specifically get those? I don't need ongoing access to this stuff, so I'd also be happy to download a DB dump of some sort for offline processing.

Example: http://jisho.org/api/v1/search/words?keyword=%E5%A4%A7%E7%B5%B1%E9%A0%98
http://jisho.org/search/%E5%A4%A7%E7%B5%B1%E9%A0%98%20%23sentences

Clearly it appears in many sentences, but none appear in the API JSON.

Also, the API docs repo seems to be empty. Has it moved?

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-11-17 10:22:03 UTC

@NeedleOrchard12 Sorry, I haven't added sentences to the API yet. So far the API is just a very early test and I haven't added much to it.

The API docs repo is a just a placeholder until I finish the API and write some proper documentation :)

483918d11ac8f3083bddd94949d8caa4
felixmark at 2015-11-17 20:50:23 UTC

I've written an Android Mobile App using your API, and wanted to ask if it's free to use.

The App however is not published yet.

If your API is free to use, I'll link you in the App so you receive the credit for the great great API you offer,
and I'd like to know if there are any further conditions for using it.

I hope you can figure out what I wanted to ask in my kind of broken english (sorry for that) ^

Ed1226ad741d954044eed43355456f33
txtsd at 2015-11-25 14:06:18 UTC

I could use the API like yesterday. I need to make a list of all "#jlpt-n5 #kanji" and "#common" to revise for the upcoming JLPT.

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2015-11-28 00:26:41 UTC

@felixmark just provide credit to Jisho.org for the API and make sure you adhere to the licenses of the data sources that Jisho uses, listed on http://jisho.org/about

@txtsd hope to have a more complete API next year.

38f9d2d55314d09a4bcd16c14c28a0c4
pietroventurini at 2016-01-20 19:40:46 UTC

I have some problems using this API..
I'm building an app which uses this API but I got this error: "Control-Allow-Origin' header is present on the requested resource"
For simple CORS requests, the server needs to add the following header to its response: " Access-Control-Allow-Origin: * "
I don't know any other way to get access to JSON data through that API

E07cec910dfd221908a1fb99def74d48
Lugo at 2016-01-21 14:43:52 UTC

Thank you very much for the API, will be very useful =)

7b6fade88ca09bc9f62156c33918e4a3
Rak at 2016-01-21 17:02:54 UTC

@pietroventurini
You are probably making a $.get ( or similiar ) request from within your browser ( maybe your index.html).
This does only work if the target ( in this case jisho.org ) has explicitly allowed a request from within the browser. As of now, it's not allowed to do that.
If you look upwards in this thread you can see a statement from Kimtaro that he planned to enable this feature, but this was some time ago so it may not be the same anymore.

The only solution for you is to make a request not from within your browser, but from your server.
If you are running your website from your file system ( the path in the browser for your application reads like 'file:://.....index.html' instead of 'localhost:...') you have to add a server side part where you can make requests.

B442028f569e5984e2d17c7106810040
JBRadio at 2016-03-16 15:41:30 UTC

Like the other posters here, I think it would be nice to have a browser extension/add-on for Jisho.org whether officially or 3rd party. It looks like this forum post has some good information on API and site requests regarding the sharing of Jisho.org information. I was just curious to know if there has been any update on this or maybe there is a developer blog for this that I can follow (outside of the GitHub API watch feature).

I am definitely interested in the API documentation and the "Access-Control-Allow-Origin"error issues as these seem to be the biggest roadblocks to making a browser extension/add-on without the need of a proxy server or server-side script.

Thank you for your hard work on this site so far and in the future.

Fb50b47c85e73d568c375db55a88e50a
Squib01 at 2016-03-18 01:25:56 UTC

The only impediment I'm facing in using the API at this time is not being able to favor if it searches in English or Japanese. Like if I search for "man" it will show results for the Japanese man but not for the English man.

B442028f569e5984e2d17c7106810040
JBRadio at 2016-03-18 02:43:02 UTC

Before the new version of Jisho.org, you could've created searches specific to English and Japanese in terms of GET variables:

http://jisho.org/words?jap=&eng=&dict=edict
- In this case, you would add a value to "Jap" for Japanese or "Eng" for English

Now, these types of searches change to http://jisho.org/search/. However, it seems like you can still specify if you are searching an english word by encasing it in quotes. There's a "hint message" after searching for man which indicate you can search for "man", so these search results are different:

http://jisho.org/search/man
http://jisho.org/search/"man"

I haven't tested many results but this seems to be the case.

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2016-03-18 18:37:35 UTC

@JBRadio no updates beyond what's in this thread I'm afraid. I don't have a developer blog. Been thinking about creating one though. I have far less time to work on Jisho than I have things I want to add :)

It's correct that using quotes is the right way to prevent Jisho from changing searches based on what it thinks you want.

B442028f569e5984e2d17c7106810040
JBRadio at 2016-03-18 23:59:28 UTC

@Squib01

I didn't really seem to find it on the homepage (http://jisho.org/) or the advance search options page (http://jisho.org/docs) but, there seems to be some additional search features. For example, uppercase english letters seem to indicate that you are writing in KATAKANA and lowercase letters seems to search in hiragana. A lowercase search can yield katakana results and likely vice versa but you'll notice that not all results are the same between both lower/uppercase search results.

The search comments are really helpful:
"Searched for アップル."
"Searched for あっぷる."

1c207581326da3929896be861cfe9594
gawara at 2016-07-11 18:33:10 UTC

I'd love if it was possible to get API data from kanji entries as well. I tried keyword=瓦%20%23kanji, sadly this doesn't work I see. Will this be a feature in the future? I am very happy being able to search on just simply keywords though, but this would add a lot.

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2016-07-19 09:08:27 UTC

Yes, kanji data will be included in the API in a future update.

C3995ab8fe1357217e5bffedc6adeb62
fta2012 at 2016-08-02 01:08:42 UTC

Hey what's the status on enabling CORS? e.g., adding "Access-Control-Allow-Origin:*"

C3995ab8fe1357217e5bffedc6adeb62
fta2012 at 2016-08-02 02:29:46 UTC

Hmm nvm, it seems like the thing I needed (text reading assistance for a sentence) is not currently exposed through the api anyway.

And thinking about it more, what I really want is just a stripped down version of the jisho results that I can embed (e.g., highlight a sentence and get definitions / text reading assistance in a popup).

For example I considered using WWWJDIC's glossing in an iframe:

http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic?9ZIG%E6%98%A8%E6%97%A5%E3%81%99%E3%81%8D%E7%84%BC%E3%81%8D%E3%82%92%E9%A3%9F%E3%81%B9%E3%81%BE%E3%81%97%E3%81%9F

But it's so ugly compared to jisho's.

There's currently a bug with your 'X-Frame-Options' on chrome:

Invalid 'X-Frame-Options' header encountered when loading 'http://jisho.org/search/%E6%98%A8%E6%97%A5%E3%81%99%E3%81%8D%E7%84%BC%E3%81%8D%E3%82%92%E9%A3%9F%E3%81%B9%E3%81%BE%E3%81%97%E3%81%9F':
'ALLOW-FROM http://www.wanikani.com' is not a recognized directive. The header will be ignored. 

So I did play around with just embedding the existing jisho.org in an iframe. But it's way too cluttered with the search bar / side bar. If there's a version of the page that's just the main results that would be great (and account related or other sensitive stuff stripped if you're worried about clickjacking).

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2016-08-08 10:42:39 UTC

I haven't considered providing a paired down version of the page for embedding. First I'd like to "finish" the API, and then maybe provide other ways of accessing the data.

570c5a21432ca84b58c711909db5a858
Noam at 2016-08-31 20:53:33 UTC

Hi Kimtaro,
i noticed with the jlpt3 query above that the json file also produces words of jlpt4 and 5, should that be doing that or is there a way to only have jlpt3 words return?
also, i do not see any jlpt property name in the json file. how does it know it is what it is?

thanks a lot for all you've done so far!

67c718b81a86ce50274d3c38944fe531
MCManuelLP at 2016-09-02 14:26:03 UTC

Is there a specific reason why the JLPT level of a word isn't included in the tags section?

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2016-09-02 17:47:00 UTC

@Noam Yeah there seems to be something odd with the search index for the jlpt tags. I'll look into it.

@MCManuelLP The current API was a very quick test and not all data is included, like the JLPT tags. I'll add them in a future update.

483918d11ac8f3083bddd94949d8caa4
felixmark at 2016-09-05 13:38:23 UTC

@Kimtaro

Hey there~
I haven't been writing for sooo long - gomennasai @__@
So.. I've finally made a signed APK of the "Japanese Dictionary" App I was working on (I know I was gettin' creative by choosin' that name) :D
I stopped working on it.. but I actually use the app from time to time so I thought.. propably somebody else does too (:
I've uploaded the Project too, so if somebody likes to edit/enhance the app, you're free to do so~

So.. the homepage is http://japanese-dictionary.weebly.com/

Thank you again that the app is able to use the API you provide!
The best API I've seen so far~

Arigato gozaimasu Senpai~

Fd9518fb8714844926872695397f37ff
Yaku at 2016-09-07 18:15:32 UTC

Hello! I've read that there it is possible to do a jlpt search and that it would return 20 paginated items. It would be nice that it also returned the total pages that the query has. Also, when a wrong request is made (i.e: &page=1241490409432) the response is not a JSON.

Also, is there a way to contribute in the building of the API? the repo (https://github.com/Jisho-org) is empty :(

Cd0ee6233c21ef8a3dbd762e601138d9
dekaikiwi at 2016-09-10 14:20:03 UTC

Hey! Any progress on Cross Domain Headers at all? Would be keen to integrate this with a NodeJS App I'm building at the moment :)

5292c4e87e08df55ab196534cfe12cdd
Reline at 2016-09-19 01:23:20 UTC

@Kimtaro So is web scraping okay for retrieving some of the data that isn't supplied in the API?

2b8fe9a0fddca32d2845bfa9cae2e8cf
Mistval at 2016-11-27 03:45:32 UTC

I'm using this API to good effect working on a Discord bot for language learning Discord groups.

But I have the same question, is it okay to scrape for extra data?

All my results link back to Jisho.

88e8edffe72efdfadf6b50bb17d50957
makevoid at 2016-11-28 21:08:15 UTC

@Kimtaro Thanks a lot!

88e8edffe72efdfadf6b50bb17d50957
makevoid at 2016-11-28 21:08:30 UTC

@Kimtaro Thanks a lot for the API!

C12882a9f4b3dfdf86766b100f59ec43
yorika at 2016-11-30 16:24:58 UTC

Hey, @Kimtaro!

Can't find right words of gratitude for API you've provided to the community!
It's really helpful and easy to use.

One of my students found out my passion for learning Japanese language, and decided to make a chrome extension, that translates unknown words for me.

You can take a look at it:
https://chrome.google.com/webstore/detail/jhint/hmoohbgeifohgafikhihhikaknfnlgmb?hl=en

This extension has its github repository:
https://github.com/shpp/jhint
so it will be really great if somebody leaves some issues with found bugs or just propositions of enhancement.

We didn't know the right way to mention jisho.org's ownership of data in ext, so decided to provide a couple of links. But let me know if we have to do something else!

ありがとうございます!

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2016-12-02 20:54:38 UTC

@felixmark, @makevoid, @yorika - I'm very happy that the API is working well for you, and that you've managed to build cool stuff with it despite it being so basic :)

@Yaku - Yeah I should add better pagination information. I should also make sure that errors are JSON, not HTML :)

@dekaikiwi - No, I haven't yet, sorry. I hope to have some time over the next few weeks to take a look at adding cross domain support.

@Reline, @Mistval - Sure, scraping is fine, but I can't guarantee that the HTML won't change. I really should finish adding all data in Jisho to the API.

C905ffbe25ca9b81e94cd932250d250c
shotaro at 2016-12-05 15:25:21 UTC

This is exactly what I am looking for make an iOS app!!
Thank you for your contributions.

5292c4e87e08df55ab196534cfe12cdd
Reline at 2017-01-02 19:07:00 UTC

@Kimtaro I saw something of concern within the API for the "attribution"->"dbpedia" field. Is "dbpedia" supposed to be a boolean or string value? There were two different results for "house":
家...
"attribution": {
"jmdict": true,
"jmnedict": false,
"dbpedia": false
}
家屋...
"attribution": {
"jmdict": true,
"jmnedict": false,
"dbpedia": "http://dbpedia.org/resource/House"
}
Is this a bug? Just thought I'd point it out, not a big deal.

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2017-01-06 18:24:54 UTC

@Reline oops! :)

It should be a string. When there is no attribution it should probably either not be present at all, or null. I'll add a todo to fix that.

5292c4e87e08df55ab196534cfe12cdd
Reline at 2017-01-07 22:57:50 UTC

@Kimtaro thanks! I guess while I'm at it I'll throw in something that would be nice to add to the API :)

Currently it's not possible to determine which furigana belong to which kanji through the api:

{
"word": "今日は",
"reading": "こんにちは"
}

That's why I asked about doing web scraping earlier, since the html gives that distinction:




こん
にち


今日は

Thanks again for the reply and all your work on this project!

2986330e38386f92fee4774b0c54ed66
Kimtaro Admin at 2017-01-09 18:50:44 UTC

@Reline The furigana alignment is something I'd like to add to the API as well :)

to reply.