Skip to content

Instantly share code, notes, and snippets.

@stve
Created September 21, 2010 17:28
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 stve/590089 to your computer and use it in GitHub Desktop.
Save stve/590089 to your computer and use it in GitHub Desktop.
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
@stve
Copy link
Author

stve commented Sep 21, 2010

consider it done! also filtered out regular blog posts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment