summaryrefslogtreecommitdiff
path: root/tweet-archive.pl
blob: 242420676bbaa24310ef369dc2bc1ecce814bb54 (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
29
30
31
#!/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);
}
 
$store->store_friends($client->friends);
$store->store_followers($client->followers);