NAME
Net::Twitter::Search Twitter Search
SYNOPSYS
use Net::Twitter::Search;
my $twitter = Net::Twitter::Search->new();
my $results = $twitter->search('Albi the racist dragon');
foreach my $tweet (@{ $results }) {
my $speaker = $tweet->{from_user};
my $text = $tweet->{text};
my $time = $tweet->{created_at};
print "$time <$speaker> $text\n";
}
#you can also use any methods from Net::Twitter.
my $twitter = Net::Twitter::Search->new(username => $username, password => $password);
my $steve = $twitter->search('Steve');
$twitter->update($steve .'? Who is steve?');
DESCRIPTION
For searching twitter - handy for bots
METHOD
search
required parameter: query
returns: hash
EXAMPLES
Find tweets containing a word $results = $twitter->search('word');
Find tweets from a user: $results = $twitter->search('from:br3nda');
Find tweets to a user: $results = $twitter->search('to:serenecloud');
Find tweets referencing a user: $results = $twitter->search('@br3ndabot');
Find tweets containing a hashtag: $results = $twitter->search('#perl');
Combine any of the operators together: $results = $twitter->search('solaris anger from:br3nda');
Additional Parameters The search method also supports the following optional URL parameters:
lang Restricts tweets to the given language, given by an ISO 639-1 code.
$results = $twitter->search('hello', {lang=>'en'});
#search for hello in maori
$results = $twitter->search('kiaora', {lang=>'mi'});
rpp The number of tweets to return per page, up to a max of 100.
$results = $twitter->search('love', {rpp=>'10'});
page The page number to return, up to a max of roughly 1500 results (based on rpp * page)
#get page 3
$results = $twitter->search('love', {page=>'3'});
since_id Returns tweets with status ids greater than the given id. $results = $twitter->search('love', {since_id=>'1021356410'});
geocode returns tweets by users located within a given radius of the given latitude/longitude, where the user's location is taken from their Twitter profile. The parameter value is specified by "latitide,longitude,radius", where radius units must be specified as either "mi" (miles) or "km" (kilometers).
$results = $twitter->search('coffee', {geocode=> '40.757929,-73.985506,25km'});
Note that you cannot use the near operator via the API to geocode arbitrary locations; however you can use this geocode parameter to search near geocodes directly.
SEE ALSO
AUTHOR
Brenda Wallace <shiny@cpan.org>