aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrizen <trizen@protonmail.com>2020-02-27 09:12:17 +0200
committertrizen <trizen@protonmail.com>2020-02-27 09:12:17 +0200
commit04aebf06239c61268dff6ce5221db01b18266545 (patch)
tree7423c621b85653e335a1815e2cc4d98c8504c9f6
parent70665dfdba007791e7f8c8595fa7aba26449b32a (diff)
downloadfair-viewer-04aebf06239c61268dff6ce5221db01b18266545.tar.lz
fair-viewer-04aebf06239c61268dff6ce5221db01b18266545.tar.xz
fair-viewer-04aebf06239c61268dff6ce5221db01b18266545.zip
Detect when the last page of comments has been reached.
-rwxr-xr-xbin/gtk-straw-viewer2
-rwxr-xr-xbin/straw-viewer13
2 files changed, 10 insertions, 5 deletions
diff --git a/bin/gtk-straw-viewer b/bin/gtk-straw-viewer
index 4e181b5..22e90b7 100755
--- a/bin/gtk-straw-viewer
+++ b/bin/gtk-straw-viewer
@@ -3382,7 +3382,7 @@ sub display_comments {
my $url = $results->{url};
my $video_id = $results->{results}{videoId};
my $comments = $results->{results}{comments} // [];
- my $continuation = $results->{results}{continuation} // [];
+ my $continuation = $results->{results}{continuation};
foreach my $comment (@{$comments}) {
diff --git a/bin/straw-viewer b/bin/straw-viewer
index f904e1d..b20fead 100755
--- a/bin/straw-viewer
+++ b/bin/straw-viewer
@@ -2273,9 +2273,14 @@ sub general_options {
main_quit(0);
}
elsif ($option =~ /^(?:n|next)\z/ and defined $url) {
- if (defined $token) {
- my $request = $yv_obj->next_page_with_token($url, $token);
- $callback->($request);
+ if (exists $args{token}) {
+ if (defined $token) {
+ my $request = $yv_obj->next_page_with_token($url, $token);
+ $callback->($request);
+ }
+ else {
+ warn_last_page();
+ }
}
else {
my $request = $yv_obj->next_page($url);
@@ -2628,7 +2633,7 @@ sub print_comments {
my $url = $results->{url};
my $comments = $results->{results}{comments} // [];
- my $token = $results->{results}{continuation} // [];
+ my $token = $results->{results}{continuation};
my $i = 0;
foreach my $comment (@{$comments}) {