Created
September 21, 2010 17:28
-
-
Save stve/590089 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 'rubygems' | |
gem 'httparty', '= 0.4.3' | |
require 'httparty' | |
require 'tinder' | |
require 'feedzirra' | |
require 'nokogiri' | |
current_woot = nil | |
woot_url = 'http://woot.com/Blog/Feed.ashx' | |
subdomain = 'your_subdomain' | |
token = 'your_token_goes_here' | |
room_name = 'your_room' | |
post_images = false | |
post_to_campfire = true | |
campfire = Tinder::Campfire.new subdomain, :token => token | |
room = campfire.find_room_by_name room_name | |
while true | |
feed = Feedzirra::Feed.fetch_and_parse(woot_url) | |
woot = feed.entries.shift | |
while woot.categories.first != 'Woot' | |
woot = feed.entries.shift | |
end | |
if woot && current_woot != woot.url | |
html_doc = Nokogiri::HTML(woot.summary) | |
image = html_doc.at_css("img.thumbnail") | |
image_url = image['src'] if image | |
new_woot = "WootBot: #{woot.title} - #{woot.url}" | |
if post_to_campfire | |
room.speak new_woot | |
room.speak image_url if image_url && post_images | |
end | |
puts new_woot | |
puts image_url | |
current_woot = woot.url | |
end | |
sleep 30 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
consider it done! also filtered out regular blog posts