diff --git a/locales/en-US.json b/locales/en-US.json index 2d2217917..fe5d864e2 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -507,5 +507,6 @@ "timeline_parse_error_placeholder_heading": "Unable to parse item", "timeline_parse_error_placeholder_message": "Invidious encountered an error while trying to parse this item. For more information see below:", "timeline_parse_error_show_technical_details": "Show technical details", - "dmca_content": "This video cannot be downloaded on this instance due to a DMCA/copyright infringement letter sent to the instance administrator." + "dmca_content": "This video cannot be downloaded on this instance due to a DMCA/copyright infringement letter sent to the instance administrator.", + "video_details_ai_made": "AI Made video?:" } diff --git a/src/invidious/jsonify/api_v1/video_json.cr b/src/invidious/jsonify/api_v1/video_json.cr index c005b5fb8..9f34334d0 100644 --- a/src/invidious/jsonify/api_v1/video_json.cr +++ b/src/invidious/jsonify/api_v1/video_json.cr @@ -64,6 +64,7 @@ module Invidious::JSONify::APIv1 json.field "liveNow", video.live_now json.field "isPostLiveDvr", video.post_live_dvr json.field "isUpcoming", video.upcoming? + json.field "aiMade", video.ai_made if video.premiere_timestamp json.field "premiereTimestamp", video.premiere_timestamp.try &.to_unix diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index c3791afcf..b708fe4bf 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -234,6 +234,10 @@ module Invidious::Videos::Parser keywords = video_details["keywords"]? .try &.as_a.map &.as_s || [] of String + ai_made = video_primary_renderer + .try &.dig?("badges") + .try { |badges| badges.as_a.any? { |badge| badge.dig?("metadataBadgeRenderer", "label").try(&.as_s) == "AI" } } || false + # Related videos LOGGER.debug("extract_video_info: parsing related videos...") @@ -454,6 +458,7 @@ module Invidious::Videos::Parser "authorThumbnail" => JSON::Any.new(author_thumbnail.try &.as_s || ""), "authorVerified" => JSON::Any.new(author_verified || false), "subCountText" => JSON::Any.new(subs_text || "-"), + "aiMade" => JSON::Any.new(ai_made), } return params diff --git a/src/invidious/videos/videos.cr b/src/invidious/videos/videos.cr index dfaab3d31..9b8cf3a20 100644 --- a/src/invidious/videos/videos.cr +++ b/src/invidious/videos/videos.cr @@ -15,7 +15,7 @@ struct Video # NOTE: don't forget to bump this number if any change is made to # the `params` structure in videos/parser.cr!!! # - SCHEMA_VERSION = 3 + SCHEMA_VERSION = 4 property id : String @@ -297,6 +297,7 @@ struct Video getset_bool authorVerified getset_bool isFamilyFriendly getset_bool isListed + getset_bool aiMade predicate_bool upcoming, isUpcoming end diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index f9a11fde2..9a0328688 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -202,6 +202,11 @@ we're going to need to do it here in order to allow for translations.

<%= number_with_separator(video.views) %>

<%= number_with_separator(video.likes) %>

+ <% if video.ai_made %> +

<%= I18n.translate(locale, "video_details_ai_made") %> + <%= I18n.translate_bool(locale, video.ai_made) %> +

+ <% end %>

<%= I18n.translate(locale, "Genre: ") %> <% if !video.genre_url %> <%= video.genre %>