Wie viele tweets mit dem ruby-gem twitter

Schrieb ich einige ruby zur Rückgabe aller tweets mit einem Satz innerhalb eines Zeitraums. Aber dieser code wird zurückkehren, die meisten von 1.500 tweets. Wie bekomme ich mehr als 1.500 tweets? (Ich hoffe, ich bekomme Hunderte von Tausende tweets)

require "rubygems"
require "twitter"

    # returns a list of tweets containing the phrase within the dates specified
    # returns either @max_tweets tweets or all tweets found
    # @param phrase - a phrase to search for
    # @param from_date - begining date of the search ex."2011-02-28"
    # @param until_date - ending date of the search ex. "2011-03-01"
    def get_tweets(phrase, from_date, until_date)

      search = Twitter::Search.new.containing(phrase).since_date(from_date).until_date(until_date)

      #get all the tweets
      tweets = search.fetch
      next_tweets = search.fetch_next_page
      while(tweets.size < @max_tweets && next_tweets != nil) 
        tweets = tweets + next_tweets
        next_tweets = search.fetch_next_page
      end

      return tweets.first(@max_tweets)
    end
InformationsquelleAutor will | 2011-03-09
Schreibe einen Kommentar