summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-01-20 09:51:24 -0600
committerOmar Roth <omarroth@hotmail.com>2019-01-20 10:03:36 -0600
commitb23710f89f23f453a7823e56258930d95fe7d46b (patch)
treec779cdb56bc9767b723c327c9821ca1470c23252
parent277dda0dcbfcfb5eca74188073a48c919f3084f8 (diff)
downloadinvidious-b23710f89f23f453a7823e56258930d95fe7d46b.tar.gz
invidious-b23710f89f23f453a7823e56258930d95fe7d46b.tar.bz2
invidious-b23710f89f23f453a7823e56258930d95fe7d46b.zip
Fix comments without startTimeSeconds
-rw-r--r--src/invidious/comments.cr8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index 1b81c6b7..c95f79b2 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -488,10 +488,14 @@ def content_to_comment_html(content)
text = %(<a href="#{url}">#{text}</a>)
elsif watch_endpoint = run["navigationEndpoint"]["watchEndpoint"]?
- length_seconds = watch_endpoint["startTimeSeconds"].as_i
+ length_seconds = watch_endpoint["startTimeSeconds"]?
video_id = watch_endpoint["videoId"].as_s
- text = %(<a href="javascript:void(0)" onclick="player.currentTime(#{length_seconds})">#{text}</a>)
+ if length_seconds
+ text = %(<a href="javascript:void(0)" onclick="player.currentTime(#{length_seconds})">#{text}</a>)
+ else
+ text = %(<a href="/watch?v=#{video_id}">#{text}</a>)
+ end
elsif url = run["navigationEndpoint"]["commandMetadata"]?.try &.["webCommandMetadata"]["url"].as_s
text = %(<a href="#{url}">#{text}</a>)
end