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.

#!/bin/bash

# This script assumes you pre url encode your data.
# Request url
URL="http://search.twitter.com/search.json?q=";;

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

     # Shove on another character
     j=$j'A'

     # 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 ""
done

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://search.twitter.com/search.json?q=A
http_code: 200
size_request: 163 (Sent bytes)

 ......


Query Length: 138
http://search.twitter.com/search.json?q=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
http_code: 200
size_request: 300 (Sent bytes)

Query Length: 139
http://search.twitter.com/search.json?q=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
http_code: 200
size_request: 301 (Sent bytes)

Query Length: 140
http://search.twitter.com/search.json?q=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
http_code: 200
size_request: 302 (Sent bytes)

Query Length: 141
http://search.twitter.com/search.json?q=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
http_code: 403
size_request: 303 (Sent bytes)

Query Length: 142
http://search.twitter.com/search.json?q=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
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
http://search.twitter.com/search.atom?geocode=40.757929%2C-73.985506%2C25km

Or
For Since...
http://search.twitter.com/search.atom?q=twitter&since_id=1520639490




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 
tool:http://search.twitter.com/search?q=&ands=Allofthesewords&phrase=Thise...=en&from=leonspencer&to=leonspencer&ref=leonspencer&near=&within=15&units=mi&since=2009-10-07&until=2009-10-18&rpp=15

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:

http://search.twitter.com/search?q=&ands=Allofthesewords&phrase=Thise...=en&from=leonspencer&to=leonspencer&ref=leonspencer&near=&within=15&units=mi&since=2009-10-07&until=2009-10-18&rpp=15

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

Reply via email to