diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-07-22 12:15:18 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-07-22 12:15:18 -0500 |
| commit | dcf4330b3550f191a2e7025b58a52243127bcfcd (patch) | |
| tree | a73269b8d3aba32d30cf73e22df1eecd5b14ba0b | |
| parent | f4160f937ca3b8ade6937864bb277d01cea21422 (diff) | |
| download | invidious-dcf4330b3550f191a2e7025b58a52243127bcfcd.tar.gz invidious-dcf4330b3550f191a2e7025b58a52243127bcfcd.tar.bz2 invidious-dcf4330b3550f191a2e7025b58a52243127bcfcd.zip | |
Add 'commentCount' to '/comments/:id'
| -rw-r--r-- | src/invidious.cr | 5 |
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| |
