Skip to content

Commit

Permalink
Switched to using HTTParty for getting the page
Browse files Browse the repository at this point in the history
  • Loading branch information
brentsowers1 committed Sep 22, 2010
1 parent a0b1895 commit ddef738
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/twitterscour.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
require 'rubygems'
require 'nokogiri'
require 'open-uri'
#require 'open-uri'
require 'httparty'
require File.dirname(__FILE__) + "/tweet"
require 'json'

class TwitterScour
def self.from_user(username, number_of_pages=1, fetch_location_info=false)
main_page = Nokogiri::HTML(open("http://twitter.com/#{username}"))
rsp = HTTParty.get("http://twitter.com/#{username}")
raise Exception.new("Error code returned from Twitter - #{rsp.code}") if rsp.code != 200
main_page = Nokogiri::HTML(rsp.body)
main_page.css('li.status').collect do |tw|
t = Tweet.new
if tw[:class] =~ /.* u\-(.*?) .*/
Expand Down

0 comments on commit ddef738

Please sign in to comment.