Skip to content

Instantly share code, notes, and snippets.

@d6rkaiz
Created February 14, 2011 18:18
Show Gist options
  • Save d6rkaiz/826291 to your computer and use it in GitHub Desktop.
Save d6rkaiz/826291 to your computer and use it in GitHub Desktop.
twitter stream api to lingr room
#-*- coding: utf-8 -*-
require 'digest/sha1'
require 'uri'
require 'rubygems'
require 'tweetstream'
require 'curb'
# --- settings ---
# lingr bot settings.
bot_id=BOT_ID
bot_secret=BOT_SECRET
say_room=SAY_ROOM
# twitter account.
username = USERNAME
password = PASSWORD
# daemon name.
daemon_id = DAEMON_ID
# --- settings ---
verifier=Digest::SHA1.hexdigest(bot_id+bot_secret)
ts = TweetStream::Daemon.new(username,password,daemon_id)
ts.track('#lingrvim') do |status|
text = "#{status.user.screen_name} / #{status.user.name}\n#{status.text}"
puts text
sayurl="http://lingr.com/api/room/say?room=#{say_room}&bot=#{botid}&text=#{URI.escape(text)}&bot_verifier=#{verifier}"
c = Curl::Easy.new(sayurl)
c.perform
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment