Created
November 8, 2010 14:02
-
-
Save webcracy/667714 to your computer and use it in GitHub Desktop.
Poll and Scrape TVI website for a given News Show and do growl notification
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' | |
require 'open-uri' | |
require 'cgi' | |
require 'hpricot' | |
require 'ruby-growl' | |
url = "http://www.tvi.iol.pt/frame_videos_tvi.html" | |
growl = Growl.new 'localhost', 'ruby-growl', ["ruby-growl Notification"] | |
loop do | |
doc = open(url) {|f| Hpricot(f)} | |
videos = (doc/"#accordionList2"/"div"/"div.title"/"div.titleCopy"/"span") | |
videos.each do |video| | |
if CGI.unescape(video.innerHTML).include? "Jornal da Uma - 22" | |
growl.notify "ruby-growl Notification", "TVI ALERT!", "Saiu a reportagem da Quodis" | |
puts CGI.unescape(video.innerHTML) | |
end | |
end | |
sleep 15 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment