From 66340281e6fd8dde05b9306ccd5eaca574b99533 Mon Sep 17 00:00:00 2001 From: jonas-w Date: Thu, 3 Feb 2022 21:42:28 +0100 Subject: [PATCH 01/12] Added verification badge for channel view --- src/invidious/channels/about.cr | 13 +++++++++---- src/invidious/views/channel.ecr | 3 +++ src/invidious/views/community.ecr | 3 +++ src/invidious/views/playlists.ecr | 3 +++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index 0f3928f5..f92681a7 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -12,7 +12,8 @@ record AboutChannel, joined : Time, is_family_friendly : Bool, allowed_regions : Array(String), - tabs : Array(String) + tabs : Array(String), + verified : Bool record AboutRelatedChannel, ucid : String, @@ -41,7 +42,7 @@ def get_about_info(ucid, locale) : AboutChannel if !initdata.has_key?("metadata") auto_generated = true end - + verified = false if auto_generated author = initdata["header"]["interactiveTabbedHeaderRenderer"]["title"]["simpleText"].as_s author_url = initdata["microformat"]["microformatDataRenderer"]["urlCanonical"].as_s @@ -62,7 +63,7 @@ def get_about_info(ucid, locale) : AboutChannel author_thumbnail = initdata["metadata"]["channelMetadataRenderer"]["avatar"]["thumbnails"][0]["url"].as_s ucid = initdata["metadata"]["channelMetadataRenderer"]["externalId"].as_s - + # Raises a KeyError on failure. banners = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["banner"]?.try &.["thumbnails"]? banner = banners.try &.[-1]?.try &.["url"].as_s? @@ -70,7 +71,10 @@ def get_about_info(ucid, locale) : AboutChannel # if banner.includes? "channels/c4/default_banner" # banner = nil # end - + badges = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["badges"]? + if !badges.nil? + verified=true + end description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || "" description_html = HTML.escape(description) @@ -128,6 +132,7 @@ def get_about_info(ucid, locale) : AboutChannel is_family_friendly: is_family_friendly, allowed_regions: allowed_regions, tabs: tabs, + verified: verified, ) end diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr index 40b553a9..f14546a5 100644 --- a/src/invidious/views/channel.ecr +++ b/src/invidious/views/channel.ecr @@ -21,6 +21,9 @@
<%= author %> + <% if channel.verified %> + + <% end %>
diff --git a/src/invidious/views/community.ecr b/src/invidious/views/community.ecr index f0add06b..bb4994d2 100644 --- a/src/invidious/views/community.ecr +++ b/src/invidious/views/community.ecr @@ -20,6 +20,9 @@
<%= author %> + <% if channel.verified %> + + <% end %>
diff --git a/src/invidious/views/playlists.ecr b/src/invidious/views/playlists.ecr index 12dba088..df9bc76d 100644 --- a/src/invidious/views/playlists.ecr +++ b/src/invidious/views/playlists.ecr @@ -20,6 +20,9 @@
<%= author %> + <% if channel.verified %> + + <% end %>
From c584e31657770e206a583972607ca0833fa42c56 Mon Sep 17 00:00:00 2001 From: jonas-w Date: Thu, 3 Feb 2022 22:14:00 +0100 Subject: [PATCH 02/12] Inlined the if statement --- src/invidious/views/channel.ecr | 5 +---- src/invidious/views/community.ecr | 5 +---- src/invidious/views/playlists.ecr | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr index f14546a5..a32a2eed 100644 --- a/src/invidious/views/channel.ecr +++ b/src/invidious/views/channel.ecr @@ -20,10 +20,7 @@
- <%= author %> - <% if channel.verified %> - - <% end %> + <%= author %><% if channel.verified %><% end %>
diff --git a/src/invidious/views/community.ecr b/src/invidious/views/community.ecr index bb4994d2..7b002f04 100644 --- a/src/invidious/views/community.ecr +++ b/src/invidious/views/community.ecr @@ -19,10 +19,7 @@
- <%= author %> - <% if channel.verified %> - - <% end %> + <%= author %><% if channel.verified %><% end %>
diff --git a/src/invidious/views/playlists.ecr b/src/invidious/views/playlists.ecr index df9bc76d..63badf76 100644 --- a/src/invidious/views/playlists.ecr +++ b/src/invidious/views/playlists.ecr @@ -19,10 +19,7 @@
- <%= author %> - <% if channel.verified %> - - <% end %> + <%= author %><% if channel.verified %><% end %>
From 154bca463554c4305cf616df1e65abbf30136019 Mon Sep 17 00:00:00 2001 From: jonas-w Date: Thu, 3 Feb 2022 22:32:00 +0100 Subject: [PATCH 03/12] Added Verification Badge to Youtube Comments --- src/invidious/comments.cr | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 65f4b135..6febbe45 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -144,7 +144,8 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b content_html = node_comment["contentText"]?.try { |t| parse_content(t) } || "" author = node_comment["authorText"]?.try &.["simpleText"]? || "" - + verified = node_comment["authorCommentBadge"]? != nil + json.field "verified", verified json.field "author", author json.field "authorThumbnails" do json.array do @@ -328,7 +329,9 @@ def template_youtube_comments(comments, locale, thin_mode, is_replies = false) end author_name = HTML.escape(child["author"].as_s) - + if child["verified"].as_bool + author_name += "" + end html << <<-END_HTML
From 1fee636afae81b45ee433b54077b41b4baf291ea Mon Sep 17 00:00:00 2001 From: jonas-w Date: Thu, 3 Feb 2022 23:18:50 +0100 Subject: [PATCH 04/12] Added verification badge to video player and error with related_videos --- src/invidious/channels/about.cr | 4 ++-- src/invidious/videos.cr | 8 +++++++- src/invidious/views/watch.ecr | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index f92681a7..6114e8af 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -63,7 +63,7 @@ def get_about_info(ucid, locale) : AboutChannel author_thumbnail = initdata["metadata"]["channelMetadataRenderer"]["avatar"]["thumbnails"][0]["url"].as_s ucid = initdata["metadata"]["channelMetadataRenderer"]["externalId"].as_s - + # Raises a KeyError on failure. banners = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["banner"]?.try &.["thumbnails"]? banner = banners.try &.[-1]?.try &.["url"].as_s? @@ -73,7 +73,7 @@ def get_about_info(ucid, locale) : AboutChannel # end badges = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["badges"]? if !badges.nil? - verified=true + verified = true end description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || "" description_html = HTML.escape(description) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 446e8e03..a5ecdeea 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -570,6 +570,10 @@ struct Video info["authorThumbnail"]?.try &.as_s || "" end + def author_verified : Bool + info["authorVerified"].as_bool + end + def sub_count_text : String info["subCountText"]?.try &.as_s || "-" end @@ -822,6 +826,7 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)? .try &.dig?("runs", 0) author = channel_info.try &.dig?("text") + authorVerified = channel_info.try &.dig?("ownerBadges") != nil ucid = channel_info.try { |ci| HelperExtractors.get_browse_id(ci) } # "4,088,033 views", only available on compact renderer @@ -845,6 +850,7 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)? "length_seconds" => JSON::Any.new(length || "0"), "view_count" => JSON::Any.new(view_count || "0"), "short_view_count" => JSON::Any.new(short_view_count || "0"), + "author_verified" => JSON::Any.new(authorVerified), } end @@ -1037,7 +1043,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ author_info = video_secondary_renderer.try &.dig?("owner", "videoOwnerRenderer") author_thumbnail = author_info.try &.dig?("thumbnail", "thumbnails", 0, "url") - + params["authorVerified"] = JSON::Any.new(author_info.try &.["badges"]? != nil) params["authorThumbnail"] = JSON::Any.new(author_thumbnail.try &.as_s || "") params["subCountText"] = JSON::Any.new(author_info.try &.["subscriberCountText"]? diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 2e0aee99..8422fce0 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -240,7 +240,7 @@ we're going to need to do it here in order to allow for translations. <% if !video.author_thumbnail.empty? %> <% end %> - <%= author %> + <%= author %><% if video.author_verified %><% end %>
From a2578ac6b4a3ab370e2d1d483539ce9d32c272ca Mon Sep 17 00:00:00 2001 From: jonas-w Date: Fri, 4 Feb 2022 17:55:22 +0100 Subject: [PATCH 05/12] Added Verified Badge to related videos --- src/invidious/videos.cr | 8 ++++++-- src/invidious/views/watch.ecr | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index a5ecdeea..69468b5e 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -826,7 +826,11 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)? .try &.dig?("runs", 0) author = channel_info.try &.dig?("text") - authorVerified = channel_info.try &.dig?("ownerBadges") != nil + author_verified_badge = related["ownerBadges"]?.try do |badges_array| + badges_array.as_a.find(&.dig("metadataBadgeRenderer", "tooltip").as_s.== "Verified") + end + + author_verified = (author_verified_badge && author_verified_badge.size > 0).to_s ucid = channel_info.try { |ci| HelperExtractors.get_browse_id(ci) } # "4,088,033 views", only available on compact renderer @@ -850,7 +854,7 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)? "length_seconds" => JSON::Any.new(length || "0"), "view_count" => JSON::Any.new(view_count || "0"), "short_view_count" => JSON::Any.new(short_view_count || "0"), - "author_verified" => JSON::Any.new(authorVerified), + "author_verified" => JSON::Any.new(author_verified), } end diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 8422fce0..496ceddc 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -314,9 +314,9 @@ we're going to need to do it here in order to allow for translations.
<% if rv["ucid"]? %> - "><%= rv["author"]? %> + "><%= rv["author"]? %><% if rv["author_verified"].== "true" %><% end %> <% else %> - <%= rv["author"]? %> + <%= rv["author"]? %><% if rv["author_verified"].== "true" %><% end %> <% end %>
From 00df3e2c4034d99701091c0beefa6133f57b275c Mon Sep 17 00:00:00 2001 From: jonas-w Date: Fri, 4 Feb 2022 19:59:07 +0100 Subject: [PATCH 06/12] Refactored code and added badges to Search but many dummies because of the way components/item works --- src/invidious/channels/about.cr | 11 +++-- src/invidious/channels/channels.cr | 3 ++ src/invidious/comments.cr | 6 +-- src/invidious/helpers/serialized_yt_data.cr | 7 ++- src/invidious/mixes.cr | 4 ++ src/invidious/playlists.cr | 6 +++ src/invidious/routes/feeds.cr | 2 + src/invidious/videos.cr | 4 +- src/invidious/views/components/item.ecr | 8 ++-- src/invidious/yt_backend/extractors.cr | 48 +++++++++++++++------ 10 files changed, 69 insertions(+), 30 deletions(-) diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index 6114e8af..97b45df5 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -42,7 +42,7 @@ def get_about_info(ucid, locale) : AboutChannel if !initdata.has_key?("metadata") auto_generated = true end - verified = false + if auto_generated author = initdata["header"]["interactiveTabbedHeaderRenderer"]["title"]["simpleText"].as_s author_url = initdata["microformat"]["microformatDataRenderer"]["urlCanonical"].as_s @@ -71,10 +71,9 @@ def get_about_info(ucid, locale) : AboutChannel # if banner.includes? "channels/c4/default_banner" # banner = nil # end - badges = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["badges"]? - if !badges.nil? - verified = true - end + author_verified_badges = initdata["header"]?.try &.["c4TabbedHeaderRenderer"]?.try &.["badges"]? + + author_verified = (author_verified_badges && author_verified_badges.size > 0) description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || "" description_html = HTML.escape(description) @@ -132,7 +131,7 @@ def get_about_info(ucid, locale) : AboutChannel is_family_friendly: is_family_friendly, allowed_regions: allowed_regions, tabs: tabs, - verified: verified, + verified: author_verified || false, ) end diff --git a/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr index e0459cc3..9e701043 100644 --- a/src/invidious/channels/channels.cr +++ b/src/invidious/channels/channels.cr @@ -21,6 +21,7 @@ struct ChannelVideo property live_now : Bool = false property premiere_timestamp : Time? = nil property views : Int64? = nil + property author_verified : Bool #TODO currently a dummy def to_json(locale, json : JSON::Builder) json.object do @@ -218,6 +219,7 @@ def fetch_channel(ucid, pull_all_videos : Bool) live_now: live_now, premiere_timestamp: premiere_timestamp, views: views, + author_verified: false, #TODO dummy for components/item.ecr }) LOGGER.trace("fetch_channel: #{ucid} : video #{video_id} : Updating or inserting video") @@ -255,6 +257,7 @@ def fetch_channel(ucid, pull_all_videos : Bool) live_now: video.live_now, premiere_timestamp: video.premiere_timestamp, views: video.views, + author_verified: false, #TODO dummy for components/item.ecr }) } videos.each do |video| diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 6febbe45..7d52b918 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -144,8 +144,8 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b content_html = node_comment["contentText"]?.try { |t| parse_content(t) } || "" author = node_comment["authorText"]?.try &.["simpleText"]? || "" - verified = node_comment["authorCommentBadge"]? != nil - json.field "verified", verified + verified = (node_comment["authorCommentBadge"]? != nil) + json.field "verified", (verified || false) json.field "author", author json.field "authorThumbnails" do json.array do @@ -329,7 +329,7 @@ def template_youtube_comments(comments, locale, thin_mode, is_replies = false) end author_name = HTML.escape(child["author"].as_s) - if child["verified"].as_bool + if child["verified"]?.try &.as_bool author_name += "" end html << <<-END_HTML diff --git a/src/invidious/helpers/serialized_yt_data.cr b/src/invidious/helpers/serialized_yt_data.cr index bfbc237c..186bca25 100644 --- a/src/invidious/helpers/serialized_yt_data.cr +++ b/src/invidious/helpers/serialized_yt_data.cr @@ -12,6 +12,7 @@ struct SearchVideo property live_now : Bool property premium : Bool property premiere_timestamp : Time? + property author_verified : Bool def to_xml(auto_generated, query_params, xml : XML::Builder) query_params["v"] = self.id @@ -129,6 +130,7 @@ struct SearchPlaylist property video_count : Int32 property videos : Array(SearchPlaylistVideo) property thumbnail : String? + property author_verified : Bool def to_json(locale : String?, json : JSON::Builder) json.object do @@ -140,7 +142,7 @@ struct SearchPlaylist json.field "author", self.author json.field "authorId", self.ucid json.field "authorUrl", "/channel/#{self.ucid}" - + json.field "authorVerified", self.author_verified json.field "videoCount", self.video_count json.field "videos" do json.array do @@ -182,6 +184,7 @@ struct SearchChannel property video_count : Int32 property description_html : String property auto_generated : Bool + property author_verified : Bool def to_json(locale : String?, json : JSON::Builder) json.object do @@ -189,7 +192,7 @@ struct SearchChannel json.field "author", self.author json.field "authorId", self.ucid json.field "authorUrl", "/channel/#{self.ucid}" - + json.field "authorVerified", self.author_verified json.field "authorThumbnails" do json.array do qualities = {32, 48, 76, 100, 176, 512} diff --git a/src/invidious/mixes.cr b/src/invidious/mixes.cr index 3f342b92..b578e3d9 100644 --- a/src/invidious/mixes.cr +++ b/src/invidious/mixes.cr @@ -8,6 +8,10 @@ struct MixVideo property length_seconds : Int32 property index : Int32 property rdid : String + + def author_verified + false #TODO dummy + end end struct Mix diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 88888a65..a17766e3 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -234,6 +234,10 @@ struct InvidiousPlaylist 0_i64 end + def author_verified + false # TODO dummy for components/item.ecr + end + def description_html HTML.escape(self.description) end @@ -252,6 +256,7 @@ def create_playlist(title, privacy, user) updated: Time.utc, privacy: privacy, index: [] of Int64, + author_verified: false, # TODO dummy for components/item.ecr }) Invidious::Database::Playlists.insert(playlist) @@ -270,6 +275,7 @@ def subscribe_playlist(user, playlist) updated: playlist.updated, privacy: PlaylistPrivacy::Private, index: [] of Int64, + author_verified: false, # TODO dummy for components/item.ecr }) Invidious::Database::Playlists.insert(playlist) diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr index f7f7b426..6d1f098f 100644 --- a/src/invidious/routes/feeds.cr +++ b/src/invidious/routes/feeds.cr @@ -182,6 +182,7 @@ module Invidious::Routes::Feeds paid: false, premium: false, premiere_timestamp: nil, + author_verified: false, #TODO real value }) end @@ -414,6 +415,7 @@ module Invidious::Routes::Feeds live_now: video.live_now, premiere_timestamp: video.premiere_timestamp, views: video.views, + author_verified: false, #TODO dummy for components/item.ecr }) was_insert = Invidious::Database::ChannelVideos.insert(video, with_premiere_timestamp: true) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 69468b5e..c52cbe58 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -1047,7 +1047,9 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ author_info = video_secondary_renderer.try &.dig?("owner", "videoOwnerRenderer") author_thumbnail = author_info.try &.dig?("thumbnail", "thumbnails", 0, "url") - params["authorVerified"] = JSON::Any.new(author_info.try &.["badges"]? != nil) + author_verified_badge = author_info.try &.["badges"]? + + params["authorVerified"] = JSON::Any.new((author_verified_badge && author_verified_badge.size > 0) || false) params["authorThumbnail"] = JSON::Any.new(author_thumbnail.try &.as_s || "") params["subCountText"] = JSON::Any.new(author_info.try &.["subscriberCountText"]? diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index 5a93d802..db003146 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -8,7 +8,7 @@ "/> <% end %> -

<%= HTML.escape(item.author) %>

+

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><% end %>

<%= translate_count(locale, "generic_subscribers_count", item.subscriber_count, NumberFormatting::Separator) %>

<% if !item.auto_generated %>

<%= translate_count(locale, "generic_videos_count", item.video_count, NumberFormatting::Separator) %>

<% end %> @@ -30,7 +30,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %>

+

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><% end %>

<% when MixVideo %> @@ -45,7 +45,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %>

+

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><% end %>

<% when PlaylistVideo %> @@ -142,7 +142,7 @@
<% endpoint_params = "?v=#{item.id}" %> diff --git a/src/invidious/yt_backend/extractors.cr b/src/invidious/yt_backend/extractors.cr index 41d95962..28e920fa 100644 --- a/src/invidious/yt_backend/extractors.cr +++ b/src/invidious/yt_backend/extractors.cr @@ -102,7 +102,11 @@ private module Parsers premium = false premiere_timestamp = item_contents.dig?("upcomingEventData", "startTime").try { |t| Time.unix(t.as_s.to_i64) } + author_verified_badge = item_contents["ownerBadges"]?.try do |badges_array| + badges_array.as_a.find(&.dig("metadataBadgeRenderer", "tooltip").as_s.== "Verified") + end + author_verified = (author_verified_badge && author_verified_badge.size > 0) item_contents["badges"]?.try &.as_a.each do |badge| b = badge["metadataBadgeRenderer"] case b["label"].as_s @@ -129,6 +133,7 @@ private module Parsers live_now: live_now, premium: premium, premiere_timestamp: premiere_timestamp, + author_verified: author_verified || false, }) end @@ -156,7 +161,11 @@ private module Parsers private def self.parse(item_contents, author_fallback) author = extract_text(item_contents["title"]) || author_fallback.name author_id = item_contents["channelId"]?.try &.as_s || author_fallback.id + author_verified_badge = item_contents["ownerBadges"]?.try do |badges_array| + badges_array.as_a.find(&.dig("metadataBadgeRenderer", "tooltip").as_s.== "Verified") + end + author_verified = (author_verified_badge && author_verified_badge.size > 0) author_thumbnail = HelperExtractors.get_thumbnails(item_contents) # When public subscriber count is disabled, the subscriberCountText isn't sent by InnerTube. # Always simpleText @@ -179,6 +188,7 @@ private module Parsers video_count: video_count, description_html: description_html, auto_generated: auto_generated, + author_verified: author_verified || false, }) end @@ -206,18 +216,23 @@ private module Parsers private def self.parse(item_contents, author_fallback) title = extract_text(item_contents["title"]) || "" plid = item_contents["playlistId"]?.try &.as_s || "" + author_verified_badge = item_contents["ownerBadges"]?.try do |badges_array| + badges_array.as_a.find(&.dig("metadataBadgeRenderer", "tooltip").as_s.== "Verified") + end + author_verified = (author_verified_badge && author_verified_badge.size > 0) video_count = HelperExtractors.get_video_count(item_contents) playlist_thumbnail = HelperExtractors.get_thumbnails(item_contents) SearchPlaylist.new({ - title: title, - id: plid, - author: author_fallback.name, - ucid: author_fallback.id, - video_count: video_count, - videos: [] of SearchPlaylistVideo, - thumbnail: playlist_thumbnail, + title: title, + id: plid, + author: author_fallback.name, + ucid: author_fallback.id, + video_count: video_count, + videos: [] of SearchPlaylistVideo, + thumbnail: playlist_thumbnail, + author_verified: author_verified || false, }) end @@ -251,7 +266,11 @@ private module Parsers author_info = item_contents.dig?("shortBylineText", "runs", 0) author = author_info.try &.["text"].as_s || author_fallback.name author_id = author_info.try { |x| HelperExtractors.get_browse_id(x) } || author_fallback.id + author_verified_badge = item_contents["ownerBadges"]?.try do |badges_array| + badges_array.as_a.find(&.dig("metadataBadgeRenderer", "tooltip").as_s.== "Verified") + end + author_verified = (author_verified_badge && author_verified_badge.size > 0) videos = item_contents["videos"]?.try &.as_a.map do |v| v = v["childVideoRenderer"] v_title = v.dig?("title", "simpleText").try &.as_s || "" @@ -267,13 +286,14 @@ private module Parsers # TODO: item_contents["publishedTimeText"]? SearchPlaylist.new({ - title: title, - id: plid, - author: author, - ucid: author_id, - video_count: video_count, - videos: videos, - thumbnail: playlist_thumbnail, + title: title, + id: plid, + author: author, + ucid: author_id, + video_count: video_count, + videos: videos, + thumbnail: playlist_thumbnail, + author_verified: author_verified || false, }) end From 9205ccc12417bd6797d3900e19f440cf3674d427 Mon Sep 17 00:00:00 2001 From: jonas-w Date: Mon, 7 Feb 2022 02:00:43 +0100 Subject: [PATCH 07/12] Removed dummy values and added checks for items.ecr --- src/invidious/channels/channels.cr | 3 --- src/invidious/mixes.cr | 5 +---- src/invidious/playlists.cr | 9 ++------- src/invidious/routes/feeds.cr | 5 ++--- src/invidious/views/components/item.ecr | 6 +++--- 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr index 9e701043..e0459cc3 100644 --- a/src/invidious/channels/channels.cr +++ b/src/invidious/channels/channels.cr @@ -21,7 +21,6 @@ struct ChannelVideo property live_now : Bool = false property premiere_timestamp : Time? = nil property views : Int64? = nil - property author_verified : Bool #TODO currently a dummy def to_json(locale, json : JSON::Builder) json.object do @@ -219,7 +218,6 @@ def fetch_channel(ucid, pull_all_videos : Bool) live_now: live_now, premiere_timestamp: premiere_timestamp, views: views, - author_verified: false, #TODO dummy for components/item.ecr }) LOGGER.trace("fetch_channel: #{ucid} : video #{video_id} : Updating or inserting video") @@ -257,7 +255,6 @@ def fetch_channel(ucid, pull_all_videos : Bool) live_now: video.live_now, premiere_timestamp: video.premiere_timestamp, views: video.views, - author_verified: false, #TODO dummy for components/item.ecr }) } videos.each do |video| diff --git a/src/invidious/mixes.cr b/src/invidious/mixes.cr index b578e3d9..b3edea27 100644 --- a/src/invidious/mixes.cr +++ b/src/invidious/mixes.cr @@ -8,10 +8,7 @@ struct MixVideo property length_seconds : Int32 property index : Int32 property rdid : String - - def author_verified - false #TODO dummy - end + end struct Mix diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index a17766e3..8383b185 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -234,9 +234,6 @@ struct InvidiousPlaylist 0_i64 end - def author_verified - false # TODO dummy for components/item.ecr - end def description_html HTML.escape(self.description) @@ -255,8 +252,7 @@ def create_playlist(title, privacy, user) created: Time.utc, updated: Time.utc, privacy: privacy, - index: [] of Int64, - author_verified: false, # TODO dummy for components/item.ecr + index: [] of Int64 }) Invidious::Database::Playlists.insert(playlist) @@ -274,8 +270,7 @@ def subscribe_playlist(user, playlist) created: Time.utc, updated: playlist.updated, privacy: PlaylistPrivacy::Private, - index: [] of Int64, - author_verified: false, # TODO dummy for components/item.ecr + index: [] of Int64 }) Invidious::Database::Playlists.insert(playlist) diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr index 6d1f098f..c26e6da7 100644 --- a/src/invidious/routes/feeds.cr +++ b/src/invidious/routes/feeds.cr @@ -156,7 +156,7 @@ module Invidious::Routes::Feeds response = YT_POOL.client &.get("/feeds/videos.xml?channel_id=#{channel.ucid}") rss = XML.parse_html(response.body) - + print(response) videos = rss.xpath_nodes("//feed/entry").map do |entry| video_id = entry.xpath_node("videoid").not_nil!.content title = entry.xpath_node("title").not_nil!.content @@ -182,7 +182,7 @@ module Invidious::Routes::Feeds paid: false, premium: false, premiere_timestamp: nil, - author_verified: false, #TODO real value + author_verified: false, # ¯\_(ツ)_/¯ }) end @@ -415,7 +415,6 @@ module Invidious::Routes::Feeds live_now: video.live_now, premiere_timestamp: video.premiere_timestamp, views: video.views, - author_verified: false, #TODO dummy for components/item.ecr }) was_insert = Invidious::Database::ChannelVideos.insert(video, with_premiere_timestamp: true) diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index db003146..bc59233f 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -30,7 +30,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><% end %>

+

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %><% end %>

<% when MixVideo %> @@ -45,7 +45,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><% end %>

+

<%= HTML.escape(item.author) %><% if !item.is_a?(MixVideo) && !item.author_verified.nil? && item.author_verified %><% end %>

<% when PlaylistVideo %> @@ -142,7 +142,7 @@
<% endpoint_params = "?v=#{item.id}" %> From fe55141a7b5ba3372cc0f850fc388ef115d94a0d Mon Sep 17 00:00:00 2001 From: jonas-w Date: Mon, 7 Feb 2022 02:04:50 +0100 Subject: [PATCH 08/12] Crystal format --- src/invidious/mixes.cr | 1 - src/invidious/playlists.cr | 5 ++--- src/invidious/routes/feeds.cr | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/invidious/mixes.cr b/src/invidious/mixes.cr index b3edea27..3f342b92 100644 --- a/src/invidious/mixes.cr +++ b/src/invidious/mixes.cr @@ -8,7 +8,6 @@ struct MixVideo property length_seconds : Int32 property index : Int32 property rdid : String - end struct Mix diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 8383b185..88888a65 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -234,7 +234,6 @@ struct InvidiousPlaylist 0_i64 end - def description_html HTML.escape(self.description) end @@ -252,7 +251,7 @@ def create_playlist(title, privacy, user) created: Time.utc, updated: Time.utc, privacy: privacy, - index: [] of Int64 + index: [] of Int64, }) Invidious::Database::Playlists.insert(playlist) @@ -270,7 +269,7 @@ def subscribe_playlist(user, playlist) created: Time.utc, updated: playlist.updated, privacy: PlaylistPrivacy::Private, - index: [] of Int64 + index: [] of Int64, }) Invidious::Database::Playlists.insert(playlist) diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr index c26e6da7..b5b58399 100644 --- a/src/invidious/routes/feeds.cr +++ b/src/invidious/routes/feeds.cr @@ -156,7 +156,7 @@ module Invidious::Routes::Feeds response = YT_POOL.client &.get("/feeds/videos.xml?channel_id=#{channel.ucid}") rss = XML.parse_html(response.body) - print(response) + videos = rss.xpath_nodes("//feed/entry").map do |entry| video_id = entry.xpath_node("videoid").not_nil!.content title = entry.xpath_node("title").not_nil!.content @@ -182,7 +182,7 @@ module Invidious::Routes::Feeds paid: false, premium: false, premiere_timestamp: nil, - author_verified: false, # ¯\_(ツ)_/¯ + author_verified: false, # ¯\_(ツ)_/¯ }) end From f8b29674b2f09c46b74f435a485bebd04c8ce73d Mon Sep 17 00:00:00 2001 From: jonas-w Date: Mon, 7 Feb 2022 02:25:34 +0100 Subject: [PATCH 09/12] Gave them marks some space and added nil checks --- src/invidious/comments.cr | 2 +- src/invidious/views/channel.ecr | 2 +- src/invidious/views/community.ecr | 2 +- src/invidious/views/components/item.ecr | 8 ++++---- src/invidious/views/playlists.ecr | 2 +- src/invidious/views/watch.ecr | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 7d52b918..c8533c30 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -330,7 +330,7 @@ def template_youtube_comments(comments, locale, thin_mode, is_replies = false) author_name = HTML.escape(child["author"].as_s) if child["verified"]?.try &.as_bool - author_name += "" + author_name += " " end html << <<-END_HTML
diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr index a32a2eed..197c636b 100644 --- a/src/invidious/views/channel.ecr +++ b/src/invidious/views/channel.ecr @@ -20,7 +20,7 @@
- <%= author %><% if channel.verified %><% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/community.ecr b/src/invidious/views/community.ecr index 7b002f04..10ac5f04 100644 --- a/src/invidious/views/community.ecr +++ b/src/invidious/views/community.ecr @@ -19,7 +19,7 @@
- <%= author %><% if channel.verified %><% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index bc59233f..8b8df07f 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -8,7 +8,7 @@ "/> <% end %> -

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><% end %>

+

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %> <% end %>

<%= translate_count(locale, "generic_subscribers_count", item.subscriber_count, NumberFormatting::Separator) %>

<% if !item.auto_generated %>

<%= translate_count(locale, "generic_videos_count", item.video_count, NumberFormatting::Separator) %>

<% end %> @@ -30,7 +30,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %><% end %>

+

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>

<% when MixVideo %> @@ -45,7 +45,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.is_a?(MixVideo) && !item.author_verified.nil? && item.author_verified %><% end %>

+

<%= HTML.escape(item.author) %><% if !item.is_a?(MixVideo) && !item.author_verified.nil? && item.author_verified %> <% end %>

<% when PlaylistVideo %> @@ -142,7 +142,7 @@
<% endpoint_params = "?v=#{item.id}" %> diff --git a/src/invidious/views/playlists.ecr b/src/invidious/views/playlists.ecr index 63badf76..94d7a753 100644 --- a/src/invidious/views/playlists.ecr +++ b/src/invidious/views/playlists.ecr @@ -19,7 +19,7 @@
- <%= author %><% if channel.verified %><% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 496ceddc..4593affc 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -240,7 +240,7 @@ we're going to need to do it here in order to allow for translations. <% if !video.author_thumbnail.empty? %> <% end %> - <%= author %><% if video.author_verified %><% end %> + <%= author %><% if !video.author_verified.nil? && video.author_verified %> <% end %>
@@ -314,9 +314,9 @@ we're going to need to do it here in order to allow for translations.
<% if rv["ucid"]? %> - "><%= rv["author"]? %><% if rv["author_verified"].== "true" %><% end %> + "><%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% else %> - <%= rv["author"]? %><% if rv["author_verified"].== "true" %><% end %> + <%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% end %>
From aa09bbe23dcb1cf0ec04d330722905c6bb5caf86 Mon Sep 17 00:00:00 2001 From: Jonas Wunderlich Date: Sun, 13 Mar 2022 20:16:30 +0100 Subject: [PATCH 10/12] Done some refactoring --- src/invidious/channels/about.cr | 5 +++-- src/invidious/comments.cr | 5 +++-- src/invidious/helpers/serialized_yt_data.cr | 2 ++ src/invidious/videos.cr | 8 +++++--- src/invidious/views/channel.ecr | 2 +- src/invidious/views/community.ecr | 2 +- src/invidious/views/components/item.ecr | 8 ++++---- src/invidious/views/playlists.ecr | 2 +- src/invidious/views/watch.ecr | 6 +++--- 9 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index 33613260..d48fd1fb 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -71,9 +71,10 @@ def get_about_info(ucid, locale) : AboutChannel # if banner.includes? "channels/c4/default_banner" # banner = nil # end - author_verified_badges = initdata["header"]?.try &.["c4TabbedHeaderRenderer"]?.try &.["badges"]? + # author_verified_badges = initdata["header"]?.try &.["c4TabbedHeaderRenderer"]?.try &.["badges"]? + author_verified_badge = initdata["header"].dig?("c4TabbedHeaderRenderer", "badges", 0, "metadataBadgeRenderer", "tooltip") + author_verified = (author_verified_badge && author_verified_badge == "Verified") - author_verified = (author_verified_badges && author_verified_badges.size > 0) description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || "" description_html = HTML.escape(description) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 5215122e..d94f213f 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -145,8 +145,9 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b content_html = node_comment["contentText"]?.try { |t| parse_content(t) } || "" author = node_comment["authorText"]?.try &.["simpleText"]? || "" - verified = (node_comment["authorCommentBadge"]? != nil) - json.field "verified", (verified || false) + + json.field "verified", (node_comment["authorCommentBadge"]? != nil) + json.field "author", author json.field "authorThumbnails" do json.array do diff --git a/src/invidious/helpers/serialized_yt_data.cr b/src/invidious/helpers/serialized_yt_data.cr index 186bca25..3918bd13 100644 --- a/src/invidious/helpers/serialized_yt_data.cr +++ b/src/invidious/helpers/serialized_yt_data.cr @@ -142,7 +142,9 @@ struct SearchPlaylist json.field "author", self.author json.field "authorId", self.ucid json.field "authorUrl", "/channel/#{self.ucid}" + json.field "authorVerified", self.author_verified + json.field "videoCount", self.video_count json.field "videos" do json.array do diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index bbf3afa2..66952c93 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -594,7 +594,7 @@ struct Video end def author_verified : Bool - info["authorVerified"].as_bool + info["authorVerified"].try &.as_bool || false end def sub_count_text : String @@ -854,6 +854,7 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)? end author_verified = (author_verified_badge && author_verified_badge.size > 0).to_s + ucid = channel_info.try { |ci| HelperExtractors.get_browse_id(ci) } # "4,088,033 views", only available on compact renderer @@ -1071,9 +1072,10 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ author_info = video_secondary_renderer.try &.dig?("owner", "videoOwnerRenderer") author_thumbnail = author_info.try &.dig?("thumbnail", "thumbnails", 0, "url") - author_verified_badge = author_info.try &.["badges"]? - params["authorVerified"] = JSON::Any.new((author_verified_badge && author_verified_badge.size > 0) || false) + author_verified_badge = author_info.try &.dig?("badges", 0, "metadataBadgeRenderer", "tooltip") + params["authorVerified"] = JSON::Any.new((author_verified_badge && author_verified_badge == "Verified")) + params["authorThumbnail"] = JSON::Any.new(author_thumbnail.try &.as_s || "") params["subCountText"] = JSON::Any.new(author_info.try &.["subscriberCountText"]? diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr index 197c636b..92f81ee4 100644 --- a/src/invidious/views/channel.ecr +++ b/src/invidious/views/channel.ecr @@ -20,7 +20,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/community.ecr b/src/invidious/views/community.ecr index 10ac5f04..3bc29e55 100644 --- a/src/invidious/views/community.ecr +++ b/src/invidious/views/community.ecr @@ -19,7 +19,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index 05478eeb..cc4ded74 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -8,7 +8,7 @@ "/> <% end %> -

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %> <% end %>

+

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %> <% end %>

<%= translate_count(locale, "generic_subscribers_count", item.subscriber_count, NumberFormatting::Separator) %>

<% if !item.auto_generated %>

<%= translate_count(locale, "generic_videos_count", item.video_count, NumberFormatting::Separator) %>

<% end %> @@ -30,7 +30,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>

+

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>

<% when MixVideo %> @@ -45,7 +45,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.is_a?(MixVideo) && !item.author_verified.nil? && item.author_verified %> <% end %>

+

<%= HTML.escape(item.author) %>

<% when PlaylistVideo %> @@ -142,7 +142,7 @@
<% endpoint_params = "?v=#{item.id}" %> diff --git a/src/invidious/views/playlists.ecr b/src/invidious/views/playlists.ecr index 94d7a753..c8718e7b 100644 --- a/src/invidious/views/playlists.ecr +++ b/src/invidious/views/playlists.ecr @@ -19,7 +19,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index bfd7821a..74a5e69f 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -206,7 +206,7 @@ we're going to need to do it here in order to allow for translations. <% if !video.author_thumbnail.empty? %> <% end %> - <%= author %><% if !video.author_verified.nil? && video.author_verified %> <% end %> + <%= author %><% if !video.author_verified.nil? && video.author_verified %> <% end %>
@@ -280,9 +280,9 @@ we're going to need to do it here in order to allow for translations.
<% if rv["ucid"]? %> - "><%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> + "><%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% else %> - <%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> + <%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% end %>
From 611e7e9dd85b9c515ab990bd6a08a98757fd8319 Mon Sep 17 00:00:00 2001 From: Jonas Wunderlich Date: Sat, 26 Mar 2022 20:13:33 +0100 Subject: [PATCH 11/12] Changed icon to checkmark and for verified author to checkmark-circle --- src/invidious/comments.cr | 6 ++++-- src/invidious/views/channel.ecr | 2 +- src/invidious/views/community.ecr | 2 +- src/invidious/views/components/item.ecr | 6 +++--- src/invidious/views/playlists.ecr | 2 +- src/invidious/views/watch.ecr | 6 +++--- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index d94f213f..54cede37 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -331,8 +331,10 @@ def template_youtube_comments(comments, locale, thin_mode, is_replies = false) end author_name = HTML.escape(child["author"].as_s) - if child["verified"]?.try &.as_bool - author_name += " " + if child["verified"]?.try &.as_bool && child["authorIsChannelOwner"]?.try &.as_bool + author_name += " " + elsif child["verified"]?.try &.as_bool + author_name += " " end html << <<-END_HTML
diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr index 92f81ee4..d6e653b4 100644 --- a/src/invidious/views/channel.ecr +++ b/src/invidious/views/channel.ecr @@ -20,7 +20,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/community.ecr b/src/invidious/views/community.ecr index 3bc29e55..6b8ccd92 100644 --- a/src/invidious/views/community.ecr +++ b/src/invidious/views/community.ecr @@ -19,7 +19,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index cc4ded74..86038f28 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -8,7 +8,7 @@ "/> <% end %> -

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %> <% end %>

+

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %> <% end %>

<%= translate_count(locale, "generic_subscribers_count", item.subscriber_count, NumberFormatting::Separator) %>

<% if !item.auto_generated %>

<%= translate_count(locale, "generic_videos_count", item.video_count, NumberFormatting::Separator) %>

<% end %> @@ -30,7 +30,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>

+

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>

<% when MixVideo %> @@ -142,7 +142,7 @@
<% endpoint_params = "?v=#{item.id}" %> diff --git a/src/invidious/views/playlists.ecr b/src/invidious/views/playlists.ecr index c8718e7b..87e0c75d 100644 --- a/src/invidious/views/playlists.ecr +++ b/src/invidious/views/playlists.ecr @@ -19,7 +19,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 74a5e69f..d79c6dc8 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -206,7 +206,7 @@ we're going to need to do it here in order to allow for translations. <% if !video.author_thumbnail.empty? %> <% end %> - <%= author %><% if !video.author_verified.nil? && video.author_verified %> <% end %> + <%= author %><% if !video.author_verified.nil? && video.author_verified %> <% end %>
@@ -280,9 +280,9 @@ we're going to need to do it here in order to allow for translations.
<% if rv["ucid"]? %> - "><%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> + "><%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% else %> - <%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> + <%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% end %>
From ec3e67e0d222d1f4c4bb278d7ce8ec804bebc137 Mon Sep 17 00:00:00 2001 From: Jonas Wunderlich Date: Sat, 26 Mar 2022 20:18:24 +0100 Subject: [PATCH 12/12] Wait that was too much replacing --- src/invidious/views/channel.ecr | 2 +- src/invidious/views/community.ecr | 2 +- src/invidious/views/components/item.ecr | 6 +++--- src/invidious/views/playlists.ecr | 2 +- src/invidious/views/watch.ecr | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr index d6e653b4..92f81ee4 100644 --- a/src/invidious/views/channel.ecr +++ b/src/invidious/views/channel.ecr @@ -20,7 +20,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/community.ecr b/src/invidious/views/community.ecr index 6b8ccd92..3bc29e55 100644 --- a/src/invidious/views/community.ecr +++ b/src/invidious/views/community.ecr @@ -19,7 +19,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index 86038f28..cc4ded74 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -8,7 +8,7 @@ "/> <% end %> -

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %> <% end %>

+

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %> <% end %>

<%= translate_count(locale, "generic_subscribers_count", item.subscriber_count, NumberFormatting::Separator) %>

<% if !item.auto_generated %>

<%= translate_count(locale, "generic_videos_count", item.video_count, NumberFormatting::Separator) %>

<% end %> @@ -30,7 +30,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>

+

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>

<% when MixVideo %> @@ -142,7 +142,7 @@
<% endpoint_params = "?v=#{item.id}" %> diff --git a/src/invidious/views/playlists.ecr b/src/invidious/views/playlists.ecr index 87e0c75d..c8718e7b 100644 --- a/src/invidious/views/playlists.ecr +++ b/src/invidious/views/playlists.ecr @@ -19,7 +19,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index d79c6dc8..74a5e69f 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -206,7 +206,7 @@ we're going to need to do it here in order to allow for translations. <% if !video.author_thumbnail.empty? %> <% end %> - <%= author %><% if !video.author_verified.nil? && video.author_verified %> <% end %> + <%= author %><% if !video.author_verified.nil? && video.author_verified %> <% end %>
@@ -280,9 +280,9 @@ we're going to need to do it here in order to allow for translations.
<% if rv["ucid"]? %> - "><%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> + "><%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% else %> - <%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> + <%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% end %>