Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use utf8;
- use strict;
- use lib '../../lib';
- use common;
- use util;
- use Net::Twitter;
- use Storable qw(nstore retrieve);
- use HTTP::Date qw(str2time time2iso);
- use Data::Dumper;
- my $L = @ARGV ? [] : eval { retrieve 'search.store' };
- my $T = Net::Twitter->new( username => 'station20', password => '******' );
- my $S = $T->search('#station20', { rpp => 100, since_id => ref $L ? $L->[-1]->{'id'} : 0 });
- my @N = reverse @{$S->{'results'} || []};
- nstore [@N ? @N : @$L], 'search.store' unless @ARGV;
- my $count; $count++, $DB->query(
- 'insert into chat set type="twitter", message=?, etc=?, created=?',
- $_->{'text'},
- join('::', @$_{'from_user', 'profile_image_url'}), # ...
- time2iso(str2time($_->{'created_at'}))
- ) for @N;
- print $count;
Add Comment
Please, Sign In to add comment