Last active
August 29, 2015 14:03
-
-
Save smokeymonkey/0e1ae3c01caf312bf719 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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