From b86476410fe4482c1851fd1a9e69e3f14452c8a5 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 11 Mar 2021 00:44:35 +0000 Subject: [PATCH] playlists: Fix description being simple text (issue #1767) --- src/invidious/playlists.cr | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 25797a36..69547457 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -101,6 +101,7 @@ struct Playlist property author_thumbnail : String property ucid : String property description : String + property description_html : String property video_count : Int32 property views : Int64 property updated : Time @@ -163,10 +164,6 @@ struct Playlist def privacy PlaylistPrivacy::Public end - - def description_html - HTML.escape(self.description).gsub("\n", "
") - end end enum PlaylistPrivacy @@ -374,8 +371,15 @@ def fetch_playlist(plid, locale) title = playlist_info["title"]?.try &.["runs"][0]?.try &.["text"]?.try &.as_s || "" + desc_item = playlist_info["description"]? - description = desc_item.try &.["runs"]?.try &.as_a.map(&.["text"].as_s).join("") || desc_item.try &.["simpleText"]?.try &.as_s || "" + + description_txt = desc_item.try &.["runs"]?.try &.as_a + .map(&.["text"].as_s).join("") || desc_item.try &.["simpleText"]?.try &.as_s || "" + + description_html = desc_item.try &.["runs"]?.try &.as_a + .try { |run| content_to_comment_html(run).try &.to_s } || "

" + thumbnail = playlist_info["thumbnailRenderer"]?.try &.["playlistVideoThumbnailRenderer"]? .try &.["thumbnail"]["thumbnails"][0]["url"]?.try &.as_s @@ -415,7 +419,8 @@ def fetch_playlist(plid, locale) author: author, author_thumbnail: author_thumbnail, ucid: ucid, - description: description, + description: description_txt, + description_html: description_html, video_count: video_count, views: views, updated: updated,