diff options
author | dakkar <dakkar@thenautilus.net> | 2018-06-29 14:57:47 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2018-06-29 14:57:47 +0100 |
commit | 2ca0c78590a78a237669820ac225c378058d9b44 (patch) | |
tree | c5a1053fee334d6ff83860d66f8108368d2c676c /lib | |
parent | giving up, just migrate the current set of people (diff) | |
download | tweet-archive-migrate-to-Twitter-API.tar.gz tweet-archive-migrate-to-Twitter-API.tar.bz2 tweet-archive-migrate-to-Twitter-API.zip |
home_timeline worksmigrate-to-Twitter-API
no automatic cursor support yet, so friends/followers won't return the
whole list
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Dakkar/TweetArchive.pm | 29 | ||||
-rw-r--r-- | lib/Dakkar/TweetArchive/Store.pm | 2 |
2 files changed, 14 insertions, 17 deletions
diff --git a/lib/Dakkar/TweetArchive.pm b/lib/Dakkar/TweetArchive.pm index 3c0d35e..f023359 100644 --- a/lib/Dakkar/TweetArchive.pm +++ b/lib/Dakkar/TweetArchive.pm @@ -2,9 +2,9 @@ package Dakkar::TweetArchive; use 5.024; use Moo; use experimental 'signatures'; -use Net::Twitter; +use Twitter::API; use Types::Standard qw(Str InstanceOf); -use namespace::clean; +use namespace::autoclean; has [qw(consumer_key consumer_secret access_token access_token_secret)] => ( is => 'ro', @@ -14,27 +14,24 @@ has [qw(consumer_key consumer_secret access_token access_token_secret)] => ( has client => ( is => 'lazy', - isa => InstanceOf['Net::Twitter'], + isa => InstanceOf['Twitter::API'], ); sub _build_client($self) { - my $nt = Net::Twitter->new( - traits => [ - qw/API::RESTv1_1 OAuth RetryOnError/, - AutoCursor => { - max_calls => 16, - force_cursor => 1, - array_accessor => 'users', - methods => [qw/friends followers/], - }, - ], + my $nt = Twitter::API->new_with_traits( + traits => [qw{Enchilada RateLimiting}], + # AutoCursor => { + # max_calls => 16, + # force_cursor => 1, + # array_accessor => 'users', + # methods => [qw/friends followers/], + # }, consumer_key => $self->consumer_key, consumer_secret => $self->consumer_secret, + access_token => $self->access_token, + access_token_secret => $self->access_token_secret, ); - $nt->access_token($self->access_token); - $nt->access_token_secret($self->access_token_secret); - return $nt; } diff --git a/lib/Dakkar/TweetArchive/Store.pm b/lib/Dakkar/TweetArchive/Store.pm index cc64a87..ee6c9e4 100644 --- a/lib/Dakkar/TweetArchive/Store.pm +++ b/lib/Dakkar/TweetArchive/Store.pm @@ -7,7 +7,7 @@ use Types::Standard qw(Str InstanceOf); use DateTime::Format::Strptime; use DateTime::Format::Pg; use JSON::MaybeXS; -use namespace::clean; +use namespace::autoclean; has [qw(dsn user pass)] => ( is => 'ro', |