aboutsummaryrefslogtreecommitdiffstats
path: root/bin/straw-viewer
diff options
context:
space:
mode:
Diffstat (limited to 'bin/straw-viewer')
-rwxr-xr-xbin/straw-viewer59
1 files changed, 31 insertions, 28 deletions
diff --git a/bin/straw-viewer b/bin/straw-viewer
index fbd0829..e444a35 100755
--- a/bin/straw-viewer
+++ b/bin/straw-viewer
@@ -205,7 +205,7 @@ my %CONFIG = (
publishedAfter => undef,
order => undef,
- comments_order => 'time', # valid values: time, relevance
+ comments_order => 'top', # valid values: top, new
subscriptions_order => 'relevance', # valid values: alphabetical, relevance, unread
hl => 'en_US',
@@ -222,6 +222,9 @@ my %CONFIG = (
copy_caption => 0,
cache_dir => undef, # auto-defined
+ # API
+ api_host => "https://invidio.us",
+
# Others
autoplay_mode => 0,
use_invidious_api => 0,
@@ -1148,6 +1151,7 @@ sub apply_configuration {
# ... YOUTUBE OPTIONS ... #
foreach my $option_name (
qw(
+ api_host
videoCaption maxResults order
videoDefinition videoCategoryId
videoDimension videoDuration
@@ -2683,48 +2687,47 @@ sub print_comments {
}
my $url = $results->{url};
- my $info = $results->{results} // {};
- my $comments = $info->{items} // [];
+ my $comments = $results->{results}{comments} // [];
my $i = 0;
foreach my $comment (@{$comments}) {
- my $snippet = (($comment->{snippet} // next)->{topLevelComment} // next)->{snippet};
- my $comment_age = $yv_utils->date_to_age($snippet->{publishedAt});
+ my $comment_id = $yv_utils->get_comment_id($comment);
+ my $comment_age = $yv_utils->get_publication_age_approx($comment);
printf(
"\n%s (%s) commented:\n%s\n",
- colored($snippet->{authorDisplayName}, 'bold'),
+ colored($yv_utils->get_author($comment), 'bold'),
(
$comment_age =~ /sec|min|hour|day/
? "$comment_age ago"
- : $yv_utils->format_date($snippet->{publishedAt})
+ : $yv_utils->get_publication_date($comment)
),
wrap_text(
i_tab => q{ } x 3,
s_tab => q{ } x 3,
- text => [$snippet->{textDisplay} // 'Empty comment...']
+ text => [$yv_utils->get_comment_content($comment) // 'Empty comment...']
),
);
- if (exists $comment->{replies}) {
- foreach my $reply (reverse @{$comment->{replies}{comments}}) {
- my $reply_age = $yv_utils->date_to_age($reply->{snippet}{publishedAt});
- printf(
- "\n %s (%s) replied:\n%s\n",
- colored($reply->{snippet}{authorDisplayName}, 'bold'),
- (
- $reply_age =~ /sec|min|hour|day/
- ? "$reply_age ago"
- : $yv_utils->format_date($reply->{snippet}{publishedAt})
- ),
- wrap_text(
- i_tab => q{ } x 6,
- s_tab => q{ } x 6,
- text => [$reply->{snippet}{textDisplay} // 'Empty comment...']
- ),
- );
- }
- }
+ #~ if (exists $comment->{replies}) {
+ #~ foreach my $reply (reverse @{$comment->{replies}{comments}}) {
+ #~ my $reply_age = $yv_utils->date_to_age($reply->{snippet}{publishedAt});
+ #~ printf(
+ #~ "\n %s (%s) replied:\n%s\n",
+ #~ colored($reply->{snippet}{authorDisplayName}, 'bold'),
+ #~ (
+ #~ $reply_age =~ /sec|min|hour|day/
+ #~ ? "$reply_age ago"
+ #~ : $yv_utils->format_date($reply->{snippet}{publishedAt})
+ #~ ),
+ #~ wrap_text(
+ #~ i_tab => q{ } x 6,
+ #~ s_tab => q{ } x 6,
+ #~ text => [$reply->{snippet}{textDisplay} // 'Empty comment...']
+ #~ ),
+ #~ );
+ #~ }
+ #~ }
}
my @keywords = get_input_for_comments();
@@ -2740,7 +2743,7 @@ sub print_comments {
sub => __SUB__,
url => $url,
res => $comments,
- info => $info,
+ info => $results,
mode => 'comments',
args => [$videoID],
)