summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-07-22 12:15:18 -0500
committerOmar Roth <omarroth@hotmail.com>2018-07-22 12:15:18 -0500
commitdcf4330b3550f191a2e7025b58a52243127bcfcd (patch)
treea73269b8d3aba32d30cf73e22df1eecd5b14ba0b /src
parentf4160f937ca3b8ade6937864bb277d01cea21422 (diff)
downloadinvidious-dcf4330b3550f191a2e7025b58a52243127bcfcd.tar.gz
invidious-dcf4330b3550f191a2e7025b58a52243127bcfcd.tar.bz2
invidious-dcf4330b3550f191a2e7025b58a52243127bcfcd.zip
Add 'commentCount' to '/comments/:id'
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index c4791976..f9f39d59 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -530,6 +530,11 @@ get "/comments/:id" do |env|
comments = JSON.build do |json|
json.object do
+ if body["header"]?
+ comment_count = body["header"]["commentsHeaderRenderer"]["countText"]["simpleText"].as_s.rchop(" Comments").delete(',').to_i
+ json.field "commentCount", comment_count
+ end
+
json.field "comments" do
json.array do
contents.as_a.each do |item|