我正在尝试为我的推文获得回复。我使用 Net::Twitter::Lite:
my $nt = Net::Twitter::Lite->new(%consumer_tokens, %access_tokens, legacy_lists_api=>1);
my $mentions = $nt->mentions();
print Dumper $mentions;
但在那之后我只有一个错误:无法使用 OAuth 进行身份验证。有任何想法吗?
我可以发布类似的推文:
my $status = $nt->update({ status => 'some text' });
但我无法得到回复。
更新
工作:
#!/usr/bin/perl
use warnings;
use strict;
use Net::Twitter::Lite;
use Data::Dumper;
my %consumer_tokens = (
consumer_key => 'xxxxxxxxxxxxxxxxxxxxxxxx',
consumer_secret => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
);
my %access_tokens=(
access_token => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_token_secret => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
);
my $nt = Net::Twitter::Lite->new(%consumer_tokens, %access_tokens, legacy_lists_api=>1);
#217932132083970049
my $status = $nt->update({ status => 'Happy Perl People!' });
print Dumper $status;
不工作:
#!/usr/bin/perl
use warnings;
use strict;
use Net::Twitter::Lite;
use Data::Dumper;
my %consumer_tokens = (
consumer_key => 'xxxxxxxxxxxxxxxxxxxxxxxx',
consumer_secret => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
);
my %access_tokens=(
access_token => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_token_secret => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
);
my $nt = Net::Twitter::Lite->new(%consumer_tokens, %access_tokens, legacy_lists_api=>1);
#217932132083970049
my $mentions = $nt->mentions();
print Dumper $mentions;