Twitter Search API の利用回数制限は秘密らしい
他のAPIの1時間に利用できる回数の制限は150回らしいのですが、検索に関しては非公開となっているようです。
ドキュメントの上のほうしか見てなくて、150回しか使えないと思ってたからなんか得した感じ。
Search API Rate Limiting
The Search API is rate limited by IP address. The number of search requests that originate from a given IP address are counted against the search rate limiter. The specific number of requests a client is able to make to the Search API for a given hour is not released. Note that the Search API is not limited by the same 150 requests per hour limit as the REST API. The number is quite a bit higher and we feel it is both liberal and sufficient for most applications. We do not give the exact number because we want to discourage unnecessary search usage.
150回以上使えるか確認用に作ったスクリプトはこれ
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use JSON; $!=1; for my $number (1..200) { my $query = "java"; my $ua = LWP::UserAgent->new; my $res = $ua->get("http://search.twitter.com/search.json?q=$query"); if($res->is_success){ my $json = from_json($res->content, {utf8 => 1}); if($json->{error}){ printf "%4d NG: %s\n", $number, $json->{error}; }else{ printf "%4d OK: %s results\n", $number, scalar(@{$json->{results}}); } }else { die $res->status_line; } }