Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
perl twitter搜索仅返回最新tweet_Perl_Search_Twitter - Fatal编程技术网

perl twitter搜索仅返回最新tweet

perl twitter搜索仅返回最新tweet,perl,search,twitter,Perl,Search,Twitter,有了这个PERL代码片段,它可以正常工作,但只返回Twitter上的最新tweet?如果a得到了正确答案,它应该返回一组tweet $nt = Net::Twitter::Lite::WithAPIv1_1->new(%consumer_tokens); $r = $nt->search({q=>'@hullpsy'}); foreach $status ( @{$r->{statuses}} ) { $stweet = $status->{text};

有了这个PERL代码片段,它可以正常工作,但只返回Twitter上的最新tweet?如果a得到了正确答案,它应该返回一组tweet

$nt = Net::Twitter::Lite::WithAPIv1_1->new(%consumer_tokens);
$r = $nt->search({q=>'@hullpsy'});

foreach $status ( @{$r->{statuses}} )
{
    $stweet = $status->{text};
    $ssender = $status->{user}{screen_name};
    $screby = $status->{created_at};
    $stweet =~ s/  / /gi;
    $stweet =~ s/\n/ /gi;
    $stweet =~ s/\://g;
    print "$screby:$ssender:$stweet\n";
}
建议您应该在
@{$r->results}
上迭代,
not
@{$r->statuses}

不知道该库进行什么api调用,但调用$get\u tweets=$connection->get(“$twitter\u user\u id.”&count=“.tweets\u to\u display.”&include\u-rts=“.include\u-rts.”&exclude\u-repress=“;其中只返回一个结果。