mirror of
https://github.com/iv-org/invidious.git
synced 2026-11-27 16:31:41 +00:00
Compare commits
25 Commits
release-v2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f5e4945b3 | ||
|
|
d8c00579d0 | ||
|
|
8be586f386 | ||
|
|
f882ab0bd2 | ||
|
|
9af1c3824d | ||
|
|
fa031ffba0 | ||
|
|
0ae81703ad | ||
|
|
9a5c91cf80 | ||
|
|
4e9d20ddae | ||
|
|
93e9573b00 | ||
|
|
1e855775c0 | ||
|
|
23b3baf53e | ||
|
|
85ac546824 | ||
|
|
1f59da354e | ||
|
|
82e3bc424f | ||
|
|
c514dcbd45 | ||
|
|
fc17ae60c9 | ||
|
|
9274eb229b | ||
|
|
200e73556e | ||
|
|
d165dde536 | ||
|
|
21d972dcfc | ||
|
|
79761abc94 | ||
|
|
863a07b14a | ||
|
|
44f4604af8 | ||
|
|
619529aefd |
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@@ -42,7 +42,6 @@ jobs:
|
||||
matrix:
|
||||
stable: [true]
|
||||
crystal:
|
||||
- 1.14.1
|
||||
- 1.15.1
|
||||
- 1.16.3
|
||||
- 1.17.1
|
||||
@@ -50,7 +49,7 @@ jobs:
|
||||
- 1.19.2
|
||||
- 1.20.3
|
||||
- 1.21.1
|
||||
- 1.22.2
|
||||
- 1.22.3
|
||||
include:
|
||||
- crystal: nightly
|
||||
stable: false
|
||||
@@ -66,7 +65,7 @@ jobs:
|
||||
shell: bash
|
||||
|
||||
- name: Install Crystal
|
||||
uses: crystal-lang/install-crystal@v1.9.4
|
||||
uses: crystal-lang/install-crystal@v1.10.0
|
||||
with:
|
||||
crystal: ${{ matrix.crystal }}
|
||||
|
||||
@@ -138,9 +137,9 @@ jobs:
|
||||
|
||||
- name: Install Crystal
|
||||
id: lint_step_install_crystal
|
||||
uses: crystal-lang/install-crystal@v1.9.4
|
||||
uses: crystal-lang/install-crystal@v1.10.0
|
||||
with:
|
||||
crystal: 1.22.2
|
||||
crystal: 1.22.3
|
||||
|
||||
- name: Cache Shards
|
||||
uses: actions/cache@v6
|
||||
|
||||
59
CHANGELOG.md
59
CHANGELOG.md
@@ -7,6 +7,65 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## v2.20261114.0
|
||||
|
||||
### Wrap-up
|
||||
|
||||
This release updates the project to Crystal 1.22.3, ensuring compatibility with the latest language features and improvements. No user-facing changes are included; this is a maintenance release for developers and instance owners.
|
||||
|
||||
### New features & important changes
|
||||
|
||||
#### For Developers
|
||||
- Updated to Crystal 1.22.3 (#6148)
|
||||
|
||||
### Full list of pull requests merged since the last release (newest first)
|
||||
|
||||
* chore: Update to Crystal 1.22.3 (https://github.com/iv-org/invidious/pull/6148, by @Fijxu)
|
||||
* Release v2.20261113.0 (https://github.com/iv-org/invidious/pull/6146, by @github-actions[bot])
|
||||
|
||||
## v2.20261113.0
|
||||
|
||||
### Wrap-up
|
||||
|
||||
This release adds an AI-made indicator for videos that carry the AI badge and continues support for custom channel handle URLs with tab paths. It also fixes parsing of premiere timestamps on channel videos, corrects the ggpht route, and resolves parsing of published dates and view counts for collab videos.
|
||||
|
||||
For instance owners, Invidious now displays a friendly message when the config.yml file is missing. Dependency updates include http_proxy 0.17.0 and athena-negotiation 0.2.0, and CI bumps crystal-lang/install-crystal to 1.9.5.
|
||||
|
||||
### New features & important changes
|
||||
|
||||
#### For Users
|
||||
- Added an AI-made indicator for videos that carry the AI badge (#6113)
|
||||
- Support for custom channel handle URLs with tab paths, e.g. `{INSTANCE}/markrober/streams` (#5811)
|
||||
|
||||
#### For instance owners
|
||||
- Display a friendly message when the config.yml file is missing (#6121)
|
||||
- Updated http_proxy to 0.17.0 (#6142)
|
||||
- Updated athena-negotiation to 0.2.0 (#6141)
|
||||
|
||||
#### For developers
|
||||
- Bumped crystal-lang/install-crystal from 1.9.4 to 1.9.5 (#6129)
|
||||
|
||||
### Bugs fixed
|
||||
#### For Users
|
||||
- Fixed parsing of premiere_timestamp on channel videos (#6140)
|
||||
- Fixed the ggpht route (#6143)
|
||||
- Fixed parsing of published date and view count for collab videos (#5812)
|
||||
|
||||
### Full list of pull requests merged since the last release (newest first)
|
||||
|
||||
* fix: fix ggpht route after commit 3df8616 (https://github.com/iv-org/invidious/pull/6143, by @Fijxu)
|
||||
* chore(deps): update http_proxy to 0.17.0 (https://github.com/iv-org/invidious/pull/6142, by @Fijxu)
|
||||
* chore(deps): update athena-negotiation to 0.2.0 (https://github.com/iv-org/invidious/pull/6141, by @Fijxu)
|
||||
* fix: correctly parse premiere_timestamp on channel videos (https://github.com/iv-org/invidious/pull/6140, by @Fijxu)
|
||||
* chore(deps): bump crystal-lang/install-crystal from 1.9.4 to 1.9.5 (https://github.com/iv-org/invidious/pull/6129, by @dependabot[bot])
|
||||
* feat: add AI made indicator for videos that have the AI badge (https://github.com/iv-org/invidious/pull/6113, by @Fijxu)
|
||||
* chore: Display a nice message when the config.yml file is missing (https://github.com/iv-org/invidious/pull/6121, by @Fijxu)
|
||||
* Release v2.20261103.0 (https://github.com/iv-org/invidious/pull/6118, by @github-actions[bot])
|
||||
* fix(parser): parse published date and view count for collab videos (https://github.com/iv-org/invidious/pull/5812, by @radmorecameron)
|
||||
* feat: Adds support for custom channel handle urls with tab paths (ex: `{INSTANCE}/markrober/streams`) (https://github.com/iv-org/invidious/pull/5811, by @radmorecameron)
|
||||
|
||||
## v2.20261103.0
|
||||
|
||||
### Wrap-up
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
ARG OPENSSL_VERSION='3.6.5'
|
||||
ARG OPENSSL_SHA256='a2157c2830efdec3788939b00c9b0638306d3f0bbb76dc4832ee503bb397df98'
|
||||
|
||||
FROM 84codes/crystal:1.22.2-alpine AS dependabot-crystal
|
||||
FROM 84codes/crystal:1.22.3-alpine AS dependabot-crystal
|
||||
|
||||
# We compile openssl ourselves due to a memory leak in how crystal interacts
|
||||
# with openssl
|
||||
|
||||
@@ -193,6 +193,7 @@
|
||||
"search_message_no_results": "No results found.",
|
||||
"search_message_change_filters_or_query": "Try widening your search query and/or changing the filters.",
|
||||
"search_message_use_another_instance": "You can also <a href=\"`x`\">search on another instance</a>.",
|
||||
"search_message_requires_age_verification": "Youtube requires age verification for this search. Try rephrasing your search query to get results.",
|
||||
"Hide annotations": "Hide annotations",
|
||||
"Show annotations": "Show annotations",
|
||||
"Genre: ": "Genre: ",
|
||||
@@ -507,5 +508,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?:"
|
||||
}
|
||||
|
||||
18
nix/flake.lock
generated
18
nix/flake.lock
generated
@@ -5,11 +5,11 @@
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791914995,
|
||||
"narHash": "sha256-Zf/xfQEAasnwnmEfHqW/4hjDE/s44yn2hD4RuVIZRjA=",
|
||||
"lastModified": 1794427683,
|
||||
"narHash": "sha256-o7ey9gEilsxaifqJWnBDlYSKbNWYQYtKwDyXeZU2kaU=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b7a79d3fea1e214f6d668d521cecec0c01e26544",
|
||||
"rev": "cd489559845d81f673a12885576016c65cbe9363",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -20,11 +20,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1792773339,
|
||||
"narHash": "sha256-rZLrzrC6i+jnTAlvPZHogKDulY7WWDEv9hJeHieO7Zw=",
|
||||
"lastModified": 1794537146,
|
||||
"narHash": "sha256-Wpz/7x/YWnDIBu7yj6ixe8j6fIMsidd9Y+o1PqPF3iM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3ec636362e1816bc2f0888fa0fa2c69f1bc9e504",
|
||||
"rev": "d5cc6833999746cffdfe0598f7bc801a57b887a9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -42,11 +42,11 @@
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"lastModified": 1791244623,
|
||||
"narHash": "sha256-uuanbkFk8a313Zfrxdcz8Us/yQtaxNnKJtX8v0ZPpd8=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"rev": "d36eeed142f88b5a636f2e3856a53c61654cf29b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -6,7 +6,7 @@ shards:
|
||||
|
||||
athena-negotiation:
|
||||
git: https://github.com/athena-framework/negotiation.git
|
||||
version: 0.1.1
|
||||
version: 0.2.0
|
||||
|
||||
backtracer:
|
||||
git: https://github.com/sija/backtracer.cr.git
|
||||
@@ -22,7 +22,7 @@ shards:
|
||||
|
||||
http_proxy:
|
||||
git: https://github.com/mamantoha/http_proxy.git
|
||||
version: 0.10.3
|
||||
version: 0.17.0
|
||||
|
||||
kemal:
|
||||
git: https://github.com/kemalcr/kemal.git
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: invidious
|
||||
version: 2.20261103.0
|
||||
version: 2.20261114.0-dev
|
||||
|
||||
authors:
|
||||
- Invidious team <contact@invidious.io>
|
||||
@@ -29,10 +29,10 @@ dependencies:
|
||||
version: ~> 0.1.5
|
||||
athena-negotiation:
|
||||
github: athena-framework/negotiation
|
||||
version: ~> 0.1.1
|
||||
version: ~> 0.2.0
|
||||
http_proxy:
|
||||
github: mamantoha/http_proxy
|
||||
version: ~> 0.10.3
|
||||
version: ~> 0.17.0
|
||||
|
||||
development_dependencies:
|
||||
spectator:
|
||||
|
||||
@@ -228,7 +228,16 @@ class Config
|
||||
env_config_yaml = "INVIDIOUS_CONFIG"
|
||||
|
||||
config_file = ENV.has_key?(env_config_file) ? ENV.fetch(env_config_file) : "config/config.yml"
|
||||
config_yaml = ENV.has_key?(env_config_yaml) ? ENV.fetch(env_config_yaml) : File.read(config_file)
|
||||
config_yaml = if ENV.has_key?(env_config_yaml)
|
||||
ENV.fetch(env_config_yaml)
|
||||
else
|
||||
begin
|
||||
File.read(config_file)
|
||||
rescue ex
|
||||
puts "Config: Failed to load configuration file: #{ex.message}"
|
||||
exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
config = Config.from_yaml(config_yaml)
|
||||
|
||||
|
||||
@@ -56,3 +56,6 @@ class RedditIsDeprecated < InfoException
|
||||
return "Reddit comments have been removed from Invidious."
|
||||
end
|
||||
end
|
||||
|
||||
class SearchRequiresAgeVerification < InfoException
|
||||
end
|
||||
|
||||
@@ -94,6 +94,20 @@ def decode_date(string : String)
|
||||
return Time.utc(string.to_i, 1, 1)
|
||||
end
|
||||
|
||||
# Try to parse "Premieres 6/29/27, 9:00 PM"
|
||||
# For some reason, the Innertube response contains a '\u202F'
|
||||
# character in the separation between the time and the period
|
||||
# so the raw string returned by Innertube is something like this:
|
||||
# "Premieres 6/29/27, 9:00\u202FPM". Instead of using a space character
|
||||
# it uses the '\u202F' character.
|
||||
#
|
||||
# Raw: "Premieres 6/29/27, 9:00 PM"
|
||||
begin
|
||||
string2 = string.lchop("Premieres ").gsub('\u202F', " ")
|
||||
return Time.parse(string2, "%m/%d/%y, %l:%M %p", Time::Location.local)
|
||||
rescue
|
||||
end
|
||||
|
||||
# Try to parse as format Jul 10, 2000
|
||||
begin
|
||||
return Time.parse(string, "%b %-d, %Y", Time::Location.local)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,6 +9,9 @@ module Invidious::Routes::API::V1::Search
|
||||
|
||||
begin
|
||||
search_results = query.process
|
||||
if query.requires_age_verification?
|
||||
return Errors.error_json(400, "Youtube requires age verification for this search. Try rephrasing your search query to get results.")
|
||||
end
|
||||
rescue ex
|
||||
return Errors.error_json(400, ex)
|
||||
end
|
||||
|
||||
@@ -22,8 +22,11 @@ module Invidious::Routes::VideoPlayback
|
||||
host = "r#{fvip}---#{mns.pop}.googlevideo.com"
|
||||
end
|
||||
|
||||
# Sanity check, to avoid being used as an open proxy
|
||||
if !host.matches?(/[\w-]+\.(?:googlevideo|c\.youtube)\.com/)
|
||||
# Sanity check, to avoid being used as an open proxy.
|
||||
# Anchored (`\A`/`\z`), so the hostname must consist *entirely* of a
|
||||
# googlevideo.com / c.youtube.com address — an attacker-controlled suffix
|
||||
# like `evil.googlevideo.com.attacker.net` must not pass.
|
||||
if !host.matches?(/\A[\w-]+\.(?:googlevideo|c\.youtube)\.com\z/)
|
||||
return Errors.error_template(400, "Invalid \"host\" parameter.")
|
||||
end
|
||||
|
||||
|
||||
@@ -222,7 +222,8 @@ module Invidious::Routing
|
||||
end
|
||||
|
||||
def register_image_routes
|
||||
get "/ggpht/*", Routes::Images, :ggpht
|
||||
get "/ggpht/:id", Routes::Images, :ggpht
|
||||
get "/ggpht/ytc/:id", Routes::Images, :ggpht
|
||||
options "/sb/:authority/:id/:storyboard/:index", Routes::Images, :options_storyboard
|
||||
get "/sb/:authority/:id/:storyboard/:index", Routes::Images, :get_storyboard
|
||||
get "/s_p/:id/:name", Routes::Images, :s_p_image
|
||||
|
||||
@@ -20,6 +20,8 @@ module Invidious::Search
|
||||
property region : String?
|
||||
property channel : String = ""
|
||||
|
||||
getter? requires_age_verification : Bool = false
|
||||
|
||||
# Flag that indicates if the smart search features have been disabled.
|
||||
@inhibit_ssf : Bool = false
|
||||
|
||||
@@ -124,7 +126,11 @@ module Invidious::Search
|
||||
|
||||
case @type
|
||||
when .regular?, .playlist?
|
||||
items = Processors.regular(self)
|
||||
begin
|
||||
items = Processors.regular(self)
|
||||
rescue SearchRequiresAgeVerification
|
||||
@requires_age_verification = true
|
||||
end
|
||||
#
|
||||
when .channel?
|
||||
items = Processors.channel(self)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -13,7 +13,13 @@
|
||||
<hr/>
|
||||
|
||||
|
||||
<%- if items.empty? -%>
|
||||
<%- if query.requires_age_verification? -%>
|
||||
<div class="h-box no-results-error">
|
||||
<div>
|
||||
<%= I18n.translate(locale, "search_message_requires_age_verification") %><br/><br/>
|
||||
</div>
|
||||
</div>
|
||||
<%- elsif items.empty? -%>
|
||||
<div class="h-box no-results-error">
|
||||
<div>
|
||||
<%= I18n.translate(locale, "search_message_no_results") %><br/><br/>
|
||||
|
||||
@@ -202,6 +202,11 @@ we're going to need to do it here in order to allow for translations.
|
||||
<p id="views"><i class="icon ion-ios-eye"></i> <%= number_with_separator(video.views) %></p>
|
||||
<p id="likes"><i class="icon ion-ios-thumbs-up"></i> <%= number_with_separator(video.likes) %></p>
|
||||
<p id="dislikes" style="display: none; visibility: hidden;"></p>
|
||||
<% if video.ai_made %>
|
||||
<p id="ai_made"><%= I18n.translate(locale, "video_details_ai_made") %>
|
||||
<%= I18n.translate_bool(locale, video.ai_made) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<p id="genre"><%= I18n.translate(locale, "Genre: ") %>
|
||||
<% if !video.genre_url %>
|
||||
<%= video.genre %>
|
||||
|
||||
@@ -712,10 +712,18 @@ private module Parsers
|
||||
title = metadata.dig("title", "content").as_s
|
||||
published = nil
|
||||
view_count_text = nil
|
||||
premiere_timestamp = nil
|
||||
# Contains the views of the video and the published time of the video.
|
||||
if (metadata_rows = metadata.dig("metadata", "contentMetadataViewModel", "metadataRows").try &.as_a)
|
||||
metadata_rows.each do |row|
|
||||
metadata_parts = row.dig("metadataParts").try &.as_a
|
||||
# To filter members only videos, they do not have metadataParts available.
|
||||
# This videos are not hidden from the channel videos list.
|
||||
badges = row.dig?("badges").try &.as_a
|
||||
if badges.try &.any? { |item| item.dig?("badgeViewModel", "badgeStyle").try &.as_s == "BADGE_MEMBERS_ONLY" }
|
||||
next
|
||||
end
|
||||
|
||||
metadata_parts = row.dig?("metadataParts").try &.as_a
|
||||
|
||||
if view_count_text.nil?
|
||||
view_count_text = metadata_parts.try &.find { |item| item["icon"]?.nil? && item.dig?("text", "content").try &.as_s.includes?("views") }
|
||||
@@ -725,8 +733,12 @@ private module Parsers
|
||||
published = metadata_parts.try &.find { |item| item["icon"]?.nil? && item.dig?("text", "content").try &.as_s.includes?("ago") }
|
||||
.try { |item| decode_date(item.dig("text", "content").as_s) }
|
||||
end
|
||||
if premiere_timestamp.nil?
|
||||
premiere_timestamp = metadata_parts.try &.find { |item| item["icon"]?.nil? && item.dig?("text", "content").try &.as_s.includes?("Premieres") }
|
||||
.try { |item| decode_date(item.dig("text", "content").as_s) }
|
||||
end
|
||||
|
||||
break if !view_count_text.nil? && !published.nil?
|
||||
break if !view_count_text.nil? && !published.nil? && !premiere_timestamp.nil?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -745,7 +757,7 @@ private module Parsers
|
||||
views: view_count,
|
||||
description_html: "",
|
||||
length_seconds: length_seconds || 0,
|
||||
premiere_timestamp: Time.unix(0),
|
||||
premiere_timestamp: premiere_timestamp,
|
||||
author_verified: false,
|
||||
author_thumbnail: nil,
|
||||
badges: VideoBadges::None,
|
||||
@@ -801,7 +813,13 @@ private module Parsers
|
||||
.compact_map(&.dig?("thumbnailOverlayBadgeViewModel", "thumbnailBadges").try &.as_a)
|
||||
.flatten
|
||||
.find(nil, &.dig?("thumbnailBadgeViewModel", "text").try do |node|
|
||||
{"episodes", "videos", "lessons"}.any? { |str| node.as_s.ends_with?(str) }
|
||||
# Playlists that contain MORE THAN ONE video, use "videos" for their video count.
|
||||
# "text" => "8 videos"
|
||||
#
|
||||
# Playlists that contain ONLY ONE video, use "video" for their video count.
|
||||
# "text" => "1 video"
|
||||
#
|
||||
{"episodes", "videos", "video", "lessons"}.any? { |str| node.as_s.ends_with?(str) }
|
||||
end)
|
||||
.try &.dig("thumbnailBadgeViewModel", "text").as_s.to_i(strict: false)
|
||||
|
||||
@@ -1103,7 +1121,25 @@ private module Extractors
|
||||
end
|
||||
end
|
||||
|
||||
return raw_items.flatten
|
||||
raw_items = raw_items.flatten
|
||||
|
||||
requires_age_verification(raw_items)
|
||||
|
||||
return raw_items
|
||||
end
|
||||
|
||||
# 2026-11-24: Youtube started to return a new page that shows
|
||||
# a "Confirm your age" when doing suggestive searches.
|
||||
# This detects that message to set the query as a query
|
||||
# that needs age verification, forcing the user to rephrase
|
||||
# their search since there is no workaround for this.
|
||||
private def self.requires_age_verification(raw_items)
|
||||
background_promo_renderer = raw_items.first?.try &.dig?("backgroundPromoRenderer")
|
||||
background_promo_renderer_title = background_promo_renderer.try &.dig?("title", "runs", 0, "text").try &.as_s
|
||||
|
||||
if title = background_promo_renderer_title
|
||||
raise SearchRequiresAgeVerification.new if title == "Confirm your age"
|
||||
end
|
||||
end
|
||||
|
||||
def self.extractor_name
|
||||
|
||||
Reference in New Issue
Block a user