Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add first version of tgrep

  • Loading branch information...
commit 089405ee40a805d3e576475d21ab94bcb68a9322 0 parents
@leto authored
Showing with 28 additions and 0 deletions.
  1. +28 −0 searching/tgrep
28 searching/tgrep
@@ -0,0 +1,28 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Net::Twitter;
+use Twitter::TagGrep;
+my (@tags) = @ARGV;
+$|++;
+unless (@tags) {
+ print "Usage: tgrep some hash tags\n";
+ exit;
+}
+
+my $twit = Net::Twitter->new({
+ username => $ENV{TWITTERUSER},
+ password => $ENV{TWITTERPASS},
+ traits => [qw/API::REST/],
+ });
+
+my $tg = Twitter::TagGrep->new( prefix => '#!',
+ tags => [ @tags ] );
+
+my $timeline = $twit->friends_timeline({count=>200}); # max allowed
+my @matches = $tg->grep_tags($timeline);
+
+for my $tweet (@matches) {
+ print join(', ', @{$tweet->{tags}}), ": ",$tweet->{text},"\n";
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.