Subject: | [Patch] Add support for "page" parameter to followers |
Net::Twitter doesn't support the "page" parameter in the "followers"
method, making it impossible to retrieve more than the most recent 100
followers.
The attached patch provides that support, however you may want to
implement it differently.
Also note that the Net::Twitter documentation refers to twitter defaults
of 20 in several places when the current twitter API indicates 100
(method friends, for instance).
Thanks again for your work on Net::Twitter, Chris.
-Marc
Subject: | net-twitter.patch |
diff --git a/lib/Net/Twitter.pm b/lib/Net/Twitter.pm
index 43a3a05..1ea0297 100755
--- a/lib/Net/Twitter.pm
+++ b/lib/Net/Twitter.pm
@@ -10,6 +10,7 @@ use warnings;
use strict;
use LWP::UserAgent;
+use URI;
use URI::Escape;
use JSON::Any;
@@ -251,8 +252,11 @@ sub following {
sub followers {
my ( $self, $args ) = @_;
- my $url = $self->{apiurl} . "/statuses/followers.json";
- $url .= ( $args->{lite} ) ? "?lite=true" : "";
+ my $url = URI->new($self->{apiurl} . "/statuses/followers.json");
+
+ my %args = %$args; # local copy
+ $args{lite} = 'true' if $args{lite};
+ $url->query_form(%args);
my $req = $self->{ua}->get($url);
$self->{response_code} = $req->code;
$self->{response_message} = $req->message;