summaryrefslogtreecommitdiff
path: root/tweet-archive.pl
blob: 170c6afdf207c2de6317dd6f827f10543698abd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env perl 
use 5.024;
use strict;
use warnings;
use Path::Class;
use JSON::MaybeXS;
use Dakkar::TweetArchive;
use Dakkar::TweetArchive::Store;
 
my $json_parser = JSON::MaybeXS->new(
    utf8 => 1,
    relaxed => 1,
);
 
my $conf = $json_parser->decode(
    file(__FILE__)->parent->file('tweet-archive.conf')
        ->slurp(iomode=>'<:raw')
            // '{}'
    );
 
my $client = Dakkar::TweetArchive->new($conf);
my $store = Dakkar::TweetArchive::Store->new($conf);
 
my $latest_id = $store->latest_tweet_id;
 
for my $tweet ($client->home_timeline($latest_id)->@*) {
    $store->store_tweet($tweet);
}