I am not sure I understand the confusion, the API is 140 characters exactly in the query string. You can run this, don't run it often, or put a sleep 1; in the loop if you do.


# This script assumes you pre url encode your data.
# Request url

for (( i = 1; i < 200; i++ )); do
     # Current position/length
     echo "Query Length: "$i;

     # Shove on another character

     # The url we are about to poke
     echo $URL$j

RESULT=$( curl -o /dev/null -s -w "%{http_code} % {size_request}" {$URL$j} )

     # Show http_code
     http_code=`echo $RESULT | awk '{print $1}'`
     echo http_code: $http_code
     # Show size_request
     size_request=`echo $RESULT | awk '{print $2}'`
     echo size_request: $size_request \(Sent bytes\)

     echo ""

Here is a snip of the results, from the first, to the last bits around 140, right when you hit 141, it goes from http 200, to http 403. Though this script should make it rather easy to test what happens with url encoded characters. I do not think it matters, each character is a character, so if it is a space, that will get url encoded into %20 taking up three characters.

Query Length: 1
http_code: 200
size_request: 163 (Sent bytes)


Query Length: 138
http_code: 200
size_request: 300 (Sent bytes)

Query Length: 139
http_code: 200
size_request: 301 (Sent bytes)

Query Length: 140
http_code: 200
size_request: 302 (Sent bytes)

Query Length: 141
http_code: 403
size_request: 303 (Sent bytes)

Query Length: 142
http_code: 403
size_request: 304 (Sent bytes)
Scott * If you contact me off list replace talklists@ with scott@ *

On Oct 17, 2009, at 7:39 PM, leonspencer wrote:

And still waiting on a response. More information from a associate:

Subject: Re: Do you know what is being counted toward "query length"

Yeah, because your using twitter search and not api!

An Api String would be

For Geo Locations

For Since...

On Oct 17, 2:29 pm, leonspencer <spencer_l...@yahoo.com> wrote:
Still waiting for a response here. I tried a query with the Twitter
Advanced Search 

When I strip away the parameter names and operators, this is the
values stringed together:

AllofthesewordsThisexactphraseAnyofthesewordsNoneofthesewordsThishashtagenleonspencerleonspencerleonspencer15mi2009 -10-072009-10-1815

Length is at 133 but still getting error from the advanced search:


"Sorry, your query cannot be more than 140 characters long (it is 161
characters). "

Reply via email to