Skip to content

Instantly share code, notes, and snippets.

@d6rkaiz d6rkaiz/gist:826291
Created Feb 14, 2011

Embed
What would you like to do?
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
You can’t perform that action at this time.