aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authortrizen <trizen@protonmail.com>2020-06-05 21:17:42 +0300
committerJesús <heckyel@hyperbola.info>2020-06-06 21:52:47 -0500
commit754e30726f3af7d28a8b6e505fc44754f3b6f353 (patch)
tree21a8849803b733c0c69db6c48546f81af679f0f7 /bin
parent99ccfc9f20f89f0034da5647a3b8abfb5fa5387d (diff)
downloadfair-viewer-754e30726f3af7d28a8b6e505fc44754f3b6f353.tar.lz
fair-viewer-754e30726f3af7d28a8b6e505fc44754f3b6f353.tar.xz
fair-viewer-754e30726f3af7d28a8b6e505fc44754f3b6f353.zip
- Added basic support for related videos. (fixes https://github.com/trizen/straw-viewer/issues/15)
Example: fair-viewer --related [video-id / URL] This also implements support for `--autoplay`, which is based on related videos. Thanks to @aearil for reporting this issue. Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fair-viewer10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer
index 85244a3..7f3377c 100755
--- a/bin/fair-viewer
+++ b/bin/fair-viewer
@@ -3779,7 +3779,9 @@ sub print_videos {
) {
if ($opt{play_backwards}) {
#if (defined $info->{prevPageToken}) {
- __SUB__->($yv_obj->previous_page($url), auto => 1);
+ if (defined($url)) {
+ __SUB__->($yv_obj->previous_page($url), auto => 1);
+ }
#}
#else {
# $opt{play_backwards} = 0;
@@ -3789,7 +3791,9 @@ sub print_videos {
}
else {
#if (defined $info->{nextPageToken}) {
+ if (defined($url)) {
__SUB__->($yv_obj->next_page($url), auto => 1);
+ }
#}
#else {
# $opt{play_all} = 0;
@@ -3844,8 +3848,10 @@ sub print_videos {
}
elsif ($opt =~ /^(?:n|next)\z/) {
#if (defined $info->{nextPageToken}) {
+ if (defined($url)) {
my $request = $yv_obj->next_page($url);
__SUB__->($request, @keywords ? (auto => 1) : ());
+ }
#}
#else {
# warn_last_page();
@@ -3858,7 +3864,9 @@ sub print_videos {
}
elsif ($opt =~ /^(?:b|back|p|prev|previous)\z/) {
#if (defined $info->{prevPageToken}) {
+ if (defined($url)) {
__SUB__->($yv_obj->previous_page($url), @keywords ? (auto => 1) : ());
+ }
#}
#else {
# warn_first_page();