Add handling for comments with no content

このコミットが含まれているのは:
Omar Roth 2020-02-01 12:14:37 -05:00
コミット 9841f74adc
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: B8254FB7EC3D37F2
2個のファイルの変更5行の追加7行の削除

ファイルの表示

@ -628,15 +628,13 @@ def fetch_channel_community(ucid, continuation, locale, config, kemal_config, fo
post = post["backstagePostThreadRenderer"]?.try &.["post"]["backstagePostRenderer"]? || post = post["backstagePostThreadRenderer"]?.try &.["post"]["backstagePostRenderer"]? ||
post["commentThreadRenderer"]?.try &.["comment"]["commentRenderer"]? post["commentThreadRenderer"]?.try &.["comment"]["commentRenderer"]?
if !post next if !post
next
end
if !post["contentText"]? if !post["contentText"]?
content_html = "" content_html = ""
else else
content_html = post["contentText"]["simpleText"]?.try &.as_s.rchop('\ufeff').try { |block| HTML.escape(block) }.to_s || content_html = post["contentText"]["simpleText"]?.try &.as_s.rchop('\ufeff').try { |b| HTML.escape(b) }.to_s ||
content_to_comment_html(post["contentText"]["runs"].as_a).try &.to_s || "" post["contentText"]["runs"]?.try &.as_a.try { |r| content_to_comment_html(r).try &.to_s } || ""
end end
author = post["authorText"]?.try &.["simpleText"]? || "" author = post["authorText"]?.try &.["simpleText"]? || ""

ファイルの表示

@ -150,8 +150,8 @@ def fetch_youtube_comments(id, db, cursor, format, locale, thin_mode, region, so
node_comment = node["commentRenderer"] node_comment = node["commentRenderer"]
end end
content_html = node_comment["contentText"]["simpleText"]?.try &.as_s.rchop('\ufeff').try { |block| HTML.escape(block) }.to_s || content_html = node_comment["contentText"]["simpleText"]?.try &.as_s.rchop('\ufeff').try { |b| HTML.escape(b) }.to_s ||
content_to_comment_html(node_comment["contentText"]["runs"].as_a).try &.to_s || "" node_comment["contentText"]["runs"]?.try &.as_a.try { |r| content_to_comment_html(r).try &.to_s } || ""
author = node_comment["authorText"]?.try &.["simpleText"]? || "" author = node_comment["authorText"]?.try &.["simpleText"]? || ""
json.field "author", author json.field "author", author