From 9c93bbfb5708555c9f317c351b3befb7e0a61b7a Mon Sep 17 00:00:00 2001 From: chee Date: Fri, 22 Sep 2017 22:08:46 +0100 Subject: [PATCH] write a big read me --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d9258f7 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# jishon + +search jisho.org from node and the command line. + +## examples + +there is a promise interface + +```js +const jishon = require('jishon') + +(async () => { + const magic = await jishon('magic') + + console.log(magic.sentences[0]) + // { + // japanese: 'くろまほう黒魔法のはなし話をき聞きたいです。がくいん学院ではさわりしかき聞いたことがないんですがきょうみ興味があります。', + // english: 'I\'d like to hear about black magic. I was only told the highlights in the academy, and it interests me.\n — Tatoeba' + // } +}) + +// or jishon('tea').then(console.log) +``` + +there is also a callback interface + +```js +jishon('犬', (error, response) => { + const {words} = response + const common = words.find(word => word.tags.includes('common word')) + console.log(common.meanings[0].english) // => dog (Canis (lupus) familiaris) + console.log(common.audio.ogg) // => http://d1vjc5dkcd3yh2.cloudfront.net/audio_ogg/10ce3f5eb7b4a9a03c4dafce2af60e28.ogg +}) +``` + +## screen photographs of action + +search in english: + +![search in english](https://snake.dog/s/povoc/buqik.png) + +search in japanese: + +![search in japanese](https://snake.dog/s/ratad/rixar.png) + +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 + +## notes + +this will only work until `jisho.org` 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