Created
January 7, 2009 13:54
-
-
Save jaigouk/44282 to your computer and use it in GitHub Desktop.
This file contains hidden or 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('twitter4r', '0.3.0') | |
| require 'twitter' | |
| require 'twitter_search' | |
| require 'time' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| array = @wycat_merb_commits = [] | |
| @long_messages = [] | |
| merb = 'http://github.com/wycats/rails/commits/content_negotiation' | |
| # Feed parsing | |
| doc = Nokogiri::HTML(open(merb)) | |
| doc.css('div.human').each do |h| | |
| h.search('div.message').each do |k| @message = k.content end | |
| h.search('div.name').each do |k| @name = k.content end | |
| h.search('div.date').each do |k| @date = k.content end | |
| array <<{:message => @message, :name => @name, :date => @date} | |
| end | |
| # talk to twitter | |
| @post_client = Twitter::Client.new(:login => 'edgemerb', :password => '*******') | |
| @poster = String.new | |
| array.each do |a| | |
| sleep(15) | |
| genesis = 'Wed Jan 07 22:23:43 +0900 2009' | |
| @poster = a[:message] + a[:name] + a[:date] | |
| timeline = @post_client.timeline_for(:me, :since => genesis) | |
| begin | |
| timeline.each do |posted| | |
| if not (posted.text).include?(a[:message]) | |
| status =@post_client.status(:post, @poster) | |
| puts (posted.id).to_s + ' posted successfuly' | |
| else | |
| status =@post_client.status(:delete, posted.id) | |
| puts (posted.id).to_s + ' deleted successfuly' | |
| end | |
| end #timeline.each end | |
| rescue Twitter::RESTError => re | |
| unless re.code == "403" | |
| puts re | |
| end #begin-rescue end | |
| end | |
| end #array.each end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment