Skip to content

Instantly share code, notes, and snippets.

@yuki-takeichi
Created July 11, 2016 05:02
Show Gist options
  • Save yuki-takeichi/173e58aa9368ad0c78176393c9af3c0a to your computer and use it in GitHub Desktop.
Save yuki-takeichi/173e58aa9368ad0c78176393c9af3c0a to your computer and use it in GitHub Desktop.
Weblio say command
#!/bin/bash
WORD=$1
TMP_FILE=/tmp/wsay.wav
[ -z "$WORD" ] && echo "arg missing" && exit 1
WAV_URL=$(curl -s http://ejje.weblio.jp/content/$WORD | grep playSwfSound | sed -e "s/^.*playSwfSound('\([^']*\)', *'\([^']*\)'.*).*\$/\1\2\.wav/")
curl -s -o $TMP_FILE $WAV_URL
afplay $TMP_FILE
rm $TMP_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment