Skip to content

Instantly share code, notes, and snippets.

@fovtran
Created June 18, 2013 08:22
Show Gist options
  • Save fovtran/5803576 to your computer and use it in GitHub Desktop.
Save fovtran/5803576 to your computer and use it in GitHub Desktop.
REST v1.1 Twitter API 1st Status reader
#!/usr/bin/perl
# REST v1.1 Twitter API 1st Status reader
# DMC2013
# License: LGPL
#
use Net::Twitter;
use Scalar::Util 'blessed';
my $consumer_key = "";
my $consumer_secret = "";
my $token = "";
my $token_secret = "";
my $high_water = "fovtran";
my $nt = Net::Twitter->new(legacy => 0);
my $nt = Net::Twitter->new(
traits => [qw/OAuth API::RESTv1_1 WrapError/],
consumer_key => $consumer_key,
consumer_secret => $consumer_secret,
access_token => $token,
access_token_secret => $token_secret,
);
my @timeline;
print "Reading Statuse by Numbers\n";
# my $cursor = -1, my $r; $cursor; $cursor = $r->{next_cursor}
my $statuses = $nt->user_timeline({ user_id => $high_water, count => 1 });
for ( my $id = 1; $id =5; ++$id ) {
my $status = $nt->show_status({ id => $id });
print $status->{text};
push @timeline, $status->{text};
}
print @timeline;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment