Skip to content

Instantly share code, notes, and snippets.

@smokeymonkey
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smokeymonkey/0e1ae3c01caf312bf719 to your computer and use it in GitHub Desktop.
Save smokeymonkey/0e1ae3c01caf312bf719 to your computer and use it in GitHub Desktop.
require 'twitter'
CONSUMER_KEY = 'CONSUMER_KEY'
CONSUMER_SECRET = 'CONSUMER_SECRET'
OAUTH_TOKEN = 'OAUTH_TOKEN'
OAUTH_TOKEN_SECRET = 'OAUTH_TOKEN_SECRET'
API_KEY = 'VOICETEXT_WEB_API_KEY'
begin
twcli = Twitter::REST::Client.new do |config|
config.consumer_key = CONSUMER_KEY
config.consumer_secret = CONSUMER_SECRET
config.access_token = OAUTH_TOKEN
config.access_token_secret = OAUTH_TOKEN_SECRET
end
twcli.home_timeline.each do |tweet|
text = "#{tweet.user.screen_name} sayd #{tweet.text}"
system("curl",
"https://api.voicetext.jp/v1/tts", \
"-o", "text.wav", \
"-u", "#{API_KEY}:", \
"-d", "text=#{text}", \
"-d", "speaker=hikari")
puts text
system('afplay text.wav')
end
rescue
print "RuntimeError: ", $!, "\n";
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment