take a search term and get json from jisho


search from node and the command line.


there is a promise interface

  1. const jishon = require('jishon')
  2. (async () => {
  3. const magic = await jishon('magic')
  4. console.log(magic.sentences[0])
  5. // {
  6. // japanese: 'くろまほう黒魔法のはなし話をき聞きたいです。がくいん学院ではさわりしかき聞いたことがないんですがきょうみ興味があります。',
  7. // english: 'I\'d like to hear about black magic. I was only told the highlights in the academy, and it interests me.\n — Tatoeba'
  8. // }
  9. })
  10. // or jishon('tea').then(console.log)

there is also a callback interface

  1. jishon('犬', (error, response) => {
  2. const {words} = response
  3. const common = words.find(word => word.tags.includes('common word'))
  4. console.log(common.meanings[0].english) // => dog (Canis (lupus) familiaris)
  5. console.log( // =>
  6. })

there is a command line interface


  1. # with none of these passed, it will return all three
  2. -w return words
  3. -s return sentences
  4. -n return names
  5. -t 'tag' filter words by tag
  1. # get the kanji for the first common word matching 'neko'
  2. $ jishon neko -wt 'common word' | jq -r '.[0].japanese'
  3. # get the full name of the first suziki returned
  4. $ jishon suzuki -n | jq -r '.[0].meanings[0].english'
  5. Suzuki Emi (1985.9.13-)

screen photographs of action

search in english:

search in english

search in japanese:

search in japanese

note that the bottom english meaning is japanese. the dom structure on jishon isn’t great. i’ll improve that in later

ya but you can pipe it through jq for nice


there is an api, but it doesn’t provide everything i need for the projects i’m building with this, so now there’s this. it scrapes the websites. fragile as fuck

this will only work until change their layout, but for as long as i’m using it in my personal projects it’ll stay up to date.

good luck everyone