snootforge

chee/ja

get japanese pronunciation audio urls

ja

get the japanese audio urls for a word from jisho.org

installation

this isn’t on npmjs.com, so if you want to install it you’ll need to do this:

  1. $ npm i -g https://github.com/chee/ja

librarial interface

  1. const ja = require('ja')
  2. ja({
  3. term: '犬',
  4. reading: 'いぬ'
  5. }).then(results => {
  6. console.log(results[0])
  7. // => http://d1vjc5dkcd3yh2.cloudfront.net/audio/10ce3f5eb7b4a9a03c4dafce2af60e28.mp3
  8. })

you can pass raw: true to get a newline separated list as a string, instead of an array

command line interface

  1. # everything
  2. $ ja dog
  3. http://d1vjc5dkcd3yh2.cloudfront.net/audio/10ce3f5eb7b4a9a03c4dafce2af60e28.mp3
  4. http://d1vjc5dkcd3yh2.cloudfront.net/audio_ogg/10ce3f5eb7b4a9a03c4dafce2af60e28.ogg
  5. http://d1vjc5dkcd3yh2.cloudfront.net/audio/45bac2d853cf192d099f3f0fddfdba31.mp3
  6. http://d1vjc5dkcd3yh2.cloudfront.net/audio_ogg/45bac2d853cf192d099f3f0fddfdba31.ogg
  7. http://d1vjc5dkcd3yh2.cloudfront.net/audio/cec22fd7beaa43340c378e17a98fb298.mp3
  8. http://d1vjc5dkcd3yh2.cloudfront.net/audio_ogg/cec22fd7beaa43340c378e17a98fb298.ogg
  9. # by reading
  10. $ ja 犬 -r いぬ
  11. http://d1vjc5dkcd3yh2.cloudfront.net/audio/10ce3f5eb7b4a9a03c4dafce2af60e28.mp3
  12. http://d1vjc5dkcd3yh2.cloudfront.net/audio_ogg/10ce3f5eb7b4a9a03c4dafce2af60e28.ogg
  13. # by filetype
  14. $ ja dog | grep [.]ogg$
  15. http://d1vjc5dkcd3yh2.cloudfront.net/audio_ogg/10ce3f5eb7b4a9a03c4dafce2af60e28.ogg
  16. http://d1vjc5dkcd3yh2.cloudfront.net/audio_ogg/45bac2d853cf192d099f3f0fddfdba31.ogg
  17. http://d1vjc5dkcd3yh2.cloudfront.net/audio_ogg/cec22fd7beaa43340c378e17a98fb298.ogg
  18. # as json (for piping to jq/jshon)
  19. $ ja inu -r いぬ -j
  20. ["http://d1vjc5dkcd3yh2.cloudfront.net/audio/10ce3f5eb7b4a9a03c4dafce2af60e28.mp3","http://d1vjc5dkcd3yh2.cloudfront.net/audio_ogg/10ce3f5eb7b4a9a03c4dafce2af60e28.ogg"]
  21. # when there are no results
  22. $ ja pleased to meet you
  23. $ echo $?
  24. 1

todo