Compare commits

..

14 Commits

Author SHA1 Message Date
Fijxu
0f5e4945b3 feat: detect age restricted search queries and display a message about it (#6175)
* feat: detect age restricted search queries and display a message about it

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.

* and also display the message for the search API

* Update src/invidious/yt_backend/extractors.cr

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-11-27 00:37:05 -03:00
Fijxu
d8c00579d0 fix: extraction of metadata_parts in fundraiser videos (#6181)
Videos that have fundraiser in their data contain a `badges` element
with their badge data as the last item of the metadata_rows, `row.dig()`
tried to read `badges` but since it doensn't match `metadataParts` it
just fails.

using `dig?()` fixes it because it just skips `badges` as it should be.

This is how the structure of metadataRows looks like in a fundraiser
video

```
"metadataRows": [
  {
    "metadataParts": [
      {
        "text": {
          "content": "NPR Music",
          "commandRuns": [
            {
              "startIndex": 0,
              "length": 9,
              "onTap": {
                "innertubeCommand": {
                  "clickTrackingParams": "CI0IENTEDBgAIhMI_OOy14-nmAMVykO4BB0ZvzDGygEEcKuVmA==",
                  "commandMetadata": {
                    "webCommandMetadata": {
                      "url": "/@nprmusic",
                      "webPageType": "WEB_PAGE_TYPE_CHANNEL",
                      "rootVe": 3611,
                      "apiUrl": "/youtubei/v1/browse"
                    }
                  },
                  "browseEndpoint": {
                    "browseId": "UC4eYXhJI4-7wSWc8UNRwD4A",
                    "canonicalBaseUrl": "/@nprmusic"
                  }
                }
              }
            }
          ],
          "styleRuns": [
            {
              "startIndex": 0,
              "length": 9,
              "weightLabel": "FONT_WEIGHT_NORMAL"
            },
            {
              "startIndex": 9,
              "styleRunExtensions": {
                "styleRunColorMapExtension": {
                  "colorMap": [
                    {
                      "key": "USER_INTERFACE_THEME_LIGHT",
                      "value": 4284506208
                    },
                    {
                      "key": "USER_INTERFACE_THEME_DARK",
                      "value": 4289374890
                    }
                  ]
                }
              }
            }
          ],
          "attachmentRuns": [
            {
              "startIndex": 9,
              "length": 0,
              "element": {
                "type": {
                  "imageType": {
                    "image": {
                      "sources": [
                        {
                          "clientResource": {
                            "imageName": "CHECK_CIRCLE_FILLED"
                          },
                          "width": 14,
                          "height": 14
                        }
                      ]
                    }
                  }
                },
                "properties": {
                  "layoutProperties": {
                    "height": {
                      "value": 14,
                      "unit": "DIMENSION_UNIT_POINT"
                    },
                    "width": {
                      "value": 14,
                      "unit": "DIMENSION_UNIT_POINT"
                    },
                    "margin": {
                      "left": {
                        "value": 4,
                        "unit": "DIMENSION_UNIT_POINT"
                      }
                    }
                  }
                }
              },
              "alignment": "ALIGNMENT_VERTICAL_CENTER"
            }
          ]
        }
      }
    ]
  },
  {
    "metadataParts": [
      {
        "text": {
          "content": "521K views"
        }
      },
      {
        "text": {
          "content": "1 day ago"
        },
        "accessibilityLabel": "1 day ago"
      }
    ]
  },
  {
    "badges": [
      {
        "badgeViewModel": {
          "badgeText": "Fundraiser",
          "badgeStyle": "BADGE_COMMERCE",
          "trackingParams": "CI0IENTEDBgAIhMI_OOy14-nmAMVykO4BB0ZvzDG"
        }
      }
    ]
  }
],
```
2026-11-27 00:36:19 -03:00
Émilien (perso)
8be586f386 chore: crystal 1.14.x doesn't work anymore 2026-11-25 22:22:49 +01:00
dependabot[bot]
f882ab0bd2 chore(deps): bump nixpkgs from f4a03c0 to d5cc683 in /nix (#6165)
Bumps [nixpkgs](https://github.com/NixOS/nixpkgs) from `f4a03c0` to `d5cc683`.
- [Commits](f4a03c0089...d5cc683399)

---
updated-dependencies:
- dependency-name: nixpkgs
  dependency-version: d5cc6833999746cffdfe0598f7bc801a57b887a9
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-25 12:44:19 -03:00
dependabot[bot]
9af1c3824d chore(deps): bump flake-utils from bd48884 to cd48955 in /nix (#6164)
Bumps [flake-utils](https://github.com/numtide/flake-utils) from `bd48884` to `cd48955`.
- [Release notes](https://github.com/numtide/flake-utils/releases)
- [Commits](bd48884093...cd48955984)

---
updated-dependencies:
- dependency-name: flake-utils
  dependency-version: cd489559845d81f673a12885576016c65cbe9363
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-25 12:43:42 -03:00
dependabot[bot]
fa031ffba0 chore(deps): bump crystal-lang/install-crystal from 1.9.5 to 1.10.0 (#6163)
Bumps [crystal-lang/install-crystal](https://github.com/crystal-lang/install-crystal) from 1.9.5 to 1.10.0.
- [Release notes](https://github.com/crystal-lang/install-crystal/releases)
- [Commits](https://github.com/crystal-lang/install-crystal/compare/v1.9.5...v1.10.0)

---
updated-dependencies:
- dependency-name: crystal-lang/install-crystal
  dependency-version: 1.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-25 12:43:06 -03:00
Fijxu
0ae81703ad fix: fix SSRF vulnerability in videoplayback in the passed host query parameter (#6174)
Closes https://github.com/iv-org/invidious/issues/6090
2026-11-24 18:59:01 -03:00
Fijxu
9a5c91cf80 Prepare for next release 2026-11-14 11:39:59 -03:00
github-actions[bot]
4e9d20ddae Release v2.20261114.0 2026-11-14 11:34:42 -03:00
dependabot[bot]
93e9573b00 chore(deps): bump flake-utils from b7a79d3 to bd48884 in /nix (#6145)
Bumps [flake-utils](https://github.com/numtide/flake-utils) from `b7a79d3` to `bd48884`.
- [Release notes](https://github.com/numtide/flake-utils/releases)
- [Commits](b7a79d3fea...bd48884093)

---
updated-dependencies:
- dependency-name: flake-utils
  dependency-version: bd4888409339808dbaa94e2358c2c4df74b8e657
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-14 11:05:48 -03:00
dependabot[bot]
1e855775c0 chore(deps): bump nixpkgs from 3ec6363 to f4a03c0 in /nix (#6144)
Bumps [nixpkgs](https://github.com/NixOS/nixpkgs) from `3ec6363` to `f4a03c0`.
- [Commits](3ec636362e...f4a03c0089)

---
updated-dependencies:
- dependency-name: nixpkgs
  dependency-version: f4a03c008967841f2a0b3cb7c436fc6fc31671f6
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-14 11:05:37 -03:00
Fijxu
23b3baf53e chore: Update to Crystal 1.22.3 (#6148)
* chore: update to Crystal 1.22.3

* chore: update Docker image to Crystal 1.22.3
2026-11-14 10:00:40 -03:00
Fijxu
85ac546824 Prepare for next release 2026-11-13 20:11:42 -03:00
github-actions[bot]
1f59da354e Release v2.20261113.0 2026-11-13 20:09:46 -03:00
12 changed files with 78 additions and 22 deletions

View File

@@ -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.5
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.5
uses: crystal-lang/install-crystal@v1.10.0
with:
crystal: 1.22.2
crystal: 1.22.3
- name: Cache Shards
uses: actions/cache@v6

View File

@@ -8,6 +8,23 @@
## 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

View File

@@ -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

View File

@@ -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: ",

18
nix/flake.lock generated
View File

@@ -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": {

View File

@@ -1,5 +1,5 @@
name: invidious
version: 2.20261113.0
version: 2.20261114.0-dev
authors:
- Invidious team <contact@invidious.io>

View File

@@ -56,3 +56,6 @@ class RedditIsDeprecated < InfoException
return "Reddit comments have been removed from Invidious."
end
end
class SearchRequiresAgeVerification < InfoException
end

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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/>

View File

@@ -723,7 +723,7 @@ private module Parsers
next
end
metadata_parts = row.dig("metadataParts").try &.as_a
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") }
@@ -1121,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