Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8428075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:57:16+00:00 2026-06-10T04:57:16+00:00

How to get 1500 tweets? I tried the page parameter and found out, that

  • 0

How to get 1500 tweets? I tried the page parameter and found out, that this is not working and I am now stuck with max_id and since_id. I don’t know max_id and since_id. If a make a query I would like to get the most recent 1500 tweets since the query was send. Here is my code:

# -*- coding: utf-8 -*-
import urllib
import simplejson

def searchTweets(query):
 search = urllib.urlopen("http://search.twitter.com/search.json?q="+query)
 dict = simplejson.loads(search.read())
 counter = 0
 for result in dict["results"]: 
  print "*",result["text"].encode('utf-8')
  counter += 1
 print "\n",counter," tweets found","\n" 

searchTerm = "steak"
searchTweets(searchTerm+"&rpp=100&page=15")

Does anyone know a solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:57:18+00:00Added an answer on June 10, 2026 at 4:57 am

    Got this working for me for 1200 tweets:

    # -*- coding: utf-8 -*-
    import urllib
    import simplejson
    
    def searchTweets(query, minimum_tweets):
      results = []
      i=0
      while len(results)<minimum_tweets:
        if i==0: # First time through don't include max id
            response = urllib.urlopen("http://search.twitter.com/search.json?q="+query+"&rpp=100")
        else: # Subsequent times include max id
            response = urllib.urlopen("http://search.twitter.com/search.json?q="+query+"&rpp=100&max_id="+max_id)
        response = simplejson.loads(response.read())
        if not response['results']: break # Break if no tweets are returned
        max_id = str(long(response['results'][-1]['id_str'])-1) # Define max_id for next iteration
        results.extend(response['results']) # Extend tweets to results array
        i += 1
    
      print "\n",len(results)," tweets found","\n" 
    
    searchTerm = "steak"
    searchTweets(searchTerm, 1200)
    

    The problem with it is that the search twitter API breaks pretty often and there’s no error handling, or retries here. But it should show you the logic behind the max_id. I make the max_id one less than the id of the last tweet that was pulled, so there aren’t any repeats.

    Also, there are definitely more elegant ways to decide whether or not to include max_id in the url. This solution was because max_id doesn’t have a default value (which I was hoping for :p)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to get this splash page to fade in, then fade out.
I have noticed that, from Google Maps page, you can get an embed link
Right now i have this ***FIRST***1DESIGNRESULTSM25Fe415 ***Second***Fe415 ***Third***1500.0mm ***Fourth***300.0mmX600.0mmCOVER:40.0mm ***Fifth***15ENDJOINT:13SHORTCOLUMN ***Sixth***5472.00Sq.mm.REQD.CONCRETEAREA:174528.00Sq.mm ***Seventh***12-25dia.(3.27%,5890.49Sq.mm.)(Equallydistributed) ***Eighth***8mm ***Ninth***300mmc/c
I'm trying to get site in a dropbox working mainly to figure out how
I get this error while accessing a php script: W/System.err: Error reading from ./org/apache/harmony/awt/www/content/text/html.class
I want to make a request to asp.net page using jQuery.get() . How should
I am stuck here. I have row in Postgres like this: id amount a
I need to get a list of all Word Documents. *.doc and *.docx that
Im trying to get a div to have a fade out then fade in
I am trying to run this query on http://dbpedia.org/sparql but I get an error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.