diff --git a/src/invidious/helpers/extractors.cr b/src/invidious/helpers/extractors.cr index cbf397e3..dacc4ceb 100644 --- a/src/invidious/helpers/extractors.cr +++ b/src/invidious/helpers/extractors.cr @@ -358,28 +358,28 @@ private module Parsers end end - # YouTube doesn't provide dislikes. - likes = short_text_to_number(item_contents["voteCount"]["simpleText"].as_s.split(" ")[0]) + # YouTube doesn't provide dislikes. + likes = short_text_to_number(item_contents["voteCount"]["simpleText"].as_s.split(" ")[0]) - comments = item_contents.dig?("actionButtons", "commentActionButtonsRenderer", - "replyButton", "buttonRenderer", "text", "simpleText").try { |t| short_text_to_number(t.as_s) } || 0 + comments = item_contents.dig?("actionButtons", "commentActionButtonsRenderer", + "replyButton", "buttonRenderer", "text", "simpleText").try { |t| short_text_to_number(t.as_s) } || 0 - published = item_contents["publishedTimeText"]["runs"][0]["text"].try { |t| decode_date(t.as_s.rstrip(" (edited)")) } || Time.local + published = item_contents["publishedTimeText"]["runs"][0]["text"].try { |t| decode_date(t.as_s.rstrip(" (edited)")) } || Time.local - YouTubeStructs::CommunityPost.new({ - author: author_name, - author_id: author_id, - author_thumbnail: author_thumbnail, - post_id: post_id, - content_html: contents, - attachment: attachment, - likes: likes, - comments: comments, - published: published, - }) + YouTubeStructs::CommunityPost.new({ + author: author_name, + author_id: author_id, + author_thumbnail: author_thumbnail, + post_id: post_id, + content_html: contents, + attachment: attachment, + likes: likes, + comments: comments, + published: published, + }) + end end end -end # The following are the extractors for extracting an array of items from # the internal Youtube API's JSON response. The result is then packaged into