I wanted to get some counts for a number of domains, so I wrote a
simple script to perform a search with a domain name and loop through
all of the pages, counting up the number of results. This works fine
usually, but I have discovered that occasionally, the API returns
rather strange results:

?rpp=100&q=disney.com
?page=2&max_id=61422857900670976&rpp=100&q=disney.com
?page=3&max_id=61422857900670976&rpp=100&q=disney.com
?page=4&max_id=61422857900670976&rpp=100&q=disney.com
?page=5&max_id=61422857900670976&rpp=100&q=disney.com

content:
{"results":[],"max_id":-1,"since_id":0,"results_per_page":15,"page":
1,"completed_in":
1.532267,"since_id_str":"0","max_id_str":"-1","query":"disney.com"}

You'll notice that the results array is empty, the max_id is set to
-1, the results_per_page doesn't match what I specified, and the page
is set to 1 (and in that example it should have been page 5).

If I retry the URL, it usually works, so I made a work-around to
detect a max_id=-1 and retry the API call, but this seems like an
actual bug in the API (and the work-around will inflate the rate-
limit).

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to