diff options
| author | TheFrenchGhosty <47571719+TheFrenchGhosty@users.noreply.github.com> | 2021-05-22 00:11:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-22 00:11:31 +0200 |
| commit | 59ab0665188499bd8bd0dcd52cb3980e30f413d8 (patch) | |
| tree | edf7b4b2fe72a42a4effab57070080c903cf7dab | |
| parent | 2cdaef13715c5e5870f287a8039391e01f2c0174 (diff) | |
| parent | 960bd2a6be5de3fb6bb27956638fefe06fa65391 (diff) | |
| download | invidious-59ab0665188499bd8bd0dcd52cb3980e30f413d8.tar.gz invidious-59ab0665188499bd8bd0dcd52cb3980e30f413d8.tar.bz2 invidious-59ab0665188499bd8bd0dcd52cb3980e30f413d8.zip | |
Merge pull request #2110 from unixfox/fix-likes-comments
Fix the parsing of likes in the comments
| -rw-r--r-- | src/invidious/comments.cr | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 5d72503e..81d6ac2b 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -185,12 +185,14 @@ def fetch_youtube_comments(id, db, cursor, format, locale, thin_mode, region, so json.field "published", published.to_unix json.field "publishedText", translate(locale, "`x` ago", recode_date(published, locale)) - json.field "likeCount", node_comment["likeCount"] + comment_action_buttons_renderer = node_comment["actionButtons"]["commentActionButtonsRenderer"] + + json.field "likeCount", comment_action_buttons_renderer["likeButton"]["toggleButtonRenderer"]["accessibilityData"]["accessibilityData"]["label"].as_s.scan(/\d/).map(&.[0]).join.to_i json.field "commentId", node_comment["commentId"] json.field "authorIsChannelOwner", node_comment["authorIsChannelOwner"] - if node_comment["actionButtons"]["commentActionButtonsRenderer"]["creatorHeart"]? - hearth_data = node_comment["actionButtons"]["commentActionButtonsRenderer"]["creatorHeart"]["creatorHeartRenderer"]["creatorThumbnail"] + if comment_action_buttons_renderer["creatorHeart"]? + hearth_data = comment_action_buttons_renderer["creatorHeart"]["creatorHeartRenderer"]["creatorThumbnail"] json.field "creatorHeart" do json.object do json.field "creatorThumbnail", hearth_data["thumbnails"][-1]["url"] |
