diff options
Diffstat (limited to 'bin/fair-viewer')
-rwxr-xr-x | bin/fair-viewer | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer index 83d35e2..76fb6a8 100755 --- a/bin/fair-viewer +++ b/bin/fair-viewer @@ -2269,7 +2269,14 @@ sub general_options { my $callback = $args{sub}; my $results = $args{res}; my $info = $args{info}; - my $token = $args{token}; + + my $token = undef; + my $has_token = 0; + + if (ref($info->{results}) eq 'HASH' and exists $info->{results}{continuation}) { + $has_token = 1; + $token = $info->{results}{continuation}; + } if (not defined($option)) { return; @@ -2279,9 +2286,9 @@ sub general_options { main_quit(0); } elsif ($option =~ /^(?:n|next)\z/ and defined $url) { - if (exists $args{token}) { + if ($has_token) { if (defined $token) { - my $request = $yv_obj->next_page_with_token($url, $token); + my $request = $yv_obj->next_page($url, $token); $callback->($request); } else { @@ -2639,7 +2646,6 @@ sub print_comments { my $url = $results->{url}; my $comments = $results->{results}{comments} // []; - my $token = $results->{results}{continuation}; my $i = 0; foreach my $comment (@{$comments}) { @@ -2698,7 +2704,6 @@ sub print_comments { info => $results, mode => 'comments', args => [$videoID], - token => $token, ) ) { ## ok |