mirror of
https://github.com/iv-org/invidious.git
synced 2024-06-07 19:40:52 +00:00
fix replies count
This commit is contained in:
parent
1e7d330350
commit
6f3b4fbaaf
@ -201,15 +201,6 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
|
|||||||
end
|
end
|
||||||
|
|
||||||
if node_replies && !response["commentRepliesContinuation"]?
|
if node_replies && !response["commentRepliesContinuation"]?
|
||||||
if node_replies["moreText"]?
|
|
||||||
reply_count = (node_replies["moreText"]["simpleText"]? || node_replies["moreText"]["runs"]?.try &.[0]?.try &.["text"]?)
|
|
||||||
.try &.as_s.gsub(/\D/, "").to_i? || 1
|
|
||||||
elsif node_replies["viewReplies"]?
|
|
||||||
reply_count = node_replies["viewReplies"]["buttonRenderer"]["text"]?.try &.["runs"][1]?.try &.["text"]?.try &.as_s.to_i? || 1
|
|
||||||
else
|
|
||||||
reply_count = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
if node_replies["continuations"]?
|
if node_replies["continuations"]?
|
||||||
continuation = node_replies["continuations"]?.try &.as_a[0]["nextContinuationData"]["continuation"].as_s
|
continuation = node_replies["continuations"]?.try &.as_a[0]["nextContinuationData"]["continuation"].as_s
|
||||||
elsif node_replies["contents"]?
|
elsif node_replies["contents"]?
|
||||||
@ -219,7 +210,7 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
|
|||||||
|
|
||||||
json.field "replies" do
|
json.field "replies" do
|
||||||
json.object do
|
json.object do
|
||||||
json.field "replyCount", reply_count
|
json.field "replyCount", node_comment["replyCount"]? || 1
|
||||||
json.field "continuation", continuation
|
json.field "continuation", continuation
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user