mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-02 03:31:20 +05:30
Add 'commentCount' to '/comments/:id'
This commit is contained in:
parent
f4160f937c
commit
dcf4330b35
@ -530,6 +530,11 @@ get "/comments/:id" do |env|
|
|||||||
|
|
||||||
comments = JSON.build do |json|
|
comments = JSON.build do |json|
|
||||||
json.object do
|
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.field "comments" do
|
||||||
json.array do
|
json.array do
|
||||||
contents.as_a.each do |item|
|
contents.as_a.each do |item|
|
||||||
|
Loading…
Reference in New Issue
Block a user