From 0c07e9d27ac773d8423143c11bbcd36eaae0f8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milien=20=28perso=29?= <4016501+unixfox@users.noreply.github.com> Date: Fri, 4 Apr 2025 14:00:29 +0200 Subject: [PATCH 1/7] chore: set dash by default (#5216) --- config/config.example.yml | 4 ++-- src/invidious/config.cr | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index 8484c6be..d6119f29 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -858,9 +858,9 @@ default_user_preferences: ## Default video quality. ## ## Accepted values: dash, hd720, medium, small - ## Default: hd720 + ## Default: dash ## - #quality: hd720 + #quality: dash ## ## Default dash video quality. diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 9f5bbc30..4d69854c 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -35,7 +35,7 @@ struct ConfigPreferences property max_results : Int32 = 40 property notifications_only : Bool = false property player_style : String = "invidious" - property quality : String = "hd720" + property quality : String = "dash" property quality_dash : String = "auto" property default_home : String? = "Popular" property feed_menu : Array(String) = ["Popular", "Trending", "Subscriptions", "Playlists"] From d567c6be6ee8b9b0ec4583811b1cfa41e0f623e3 Mon Sep 17 00:00:00 2001 From: efb4f5ff-1298-471a-8973-3d47447115dc <73130443+efb4f5ff-1298-471a-8973-3d47447115dc@users.noreply.github.com> Date: Fri, 2 May 2025 15:36:31 +0200 Subject: [PATCH 2/7] Fix minor casing issues in brand names (#5258) --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b139c5f6..97d2109b 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,9 @@ - [Available in many languages](locales/), thanks to [our translators](#contribute) **Data import/export** -- Import subscriptions from YouTube, NewPipe and Freetube +- Import subscriptions from YouTube, NewPipe and FreeTube - Import watch history from YouTube and NewPipe -- Export subscriptions to NewPipe and Freetube +- Export subscriptions to NewPipe and FreeTube - Import/Export Invidious user data **Technical features** @@ -95,11 +95,11 @@ ## Quick start -**Using invidious:** +**Using Invidious:** - [Select a public instance from the list](https://instances.invidious.io) and start watching videos right now! -**Hosting invidious:** +**Hosting Invidious:** - [Follow the installation instructions](https://docs.invidious.io/installation/) @@ -114,8 +114,8 @@ https://github.com/iv-org/documentation ### Extensions We highly recommend the use of [Privacy Redirect](https://github.com/SimonBrazell/privacy-redirect#get), -a browser extension that automatically redirects Youtube URLs to any Invidious instance and replaces -embedded youtube videos on other websites with invidious. +a browser extension that automatically redirects YouTube URLs to any Invidious instance and replaces +embedded YouTube videos on other websites with Invidious. The documentation contains a list of browser extensions that we recommended to use along with Invidious. @@ -140,7 +140,7 @@ We use [Weblate](https://weblate.org) to manage Invidious translations. You can suggest new translations and/or correction here: https://hosted.weblate.org/engage/invidious/. Creating an account is not required, but recommended, especially if you want to contribute regularly. -Weblate also allows you to log-in with major SSO providers like Github, Gitlab, BitBucket, Google, ... +Weblate also allows you to log-in with major SSO providers like GitHub, GitLab, BitBucket, Google, ... ## Projects using Invidious From 7579adc3a3f23958afc4f11c9c52302f9962f879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milien=20=28perso=29?= <4016501+unixfox@users.noreply.github.com> Date: Fri, 2 May 2025 14:57:02 +0000 Subject: [PATCH 3/7] fix: fallback other yt clients no url found for adaptive formats (#5262) --- src/invidious/videos/parser.cr | 35 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index 26d74f37..9699a37a 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -109,27 +109,20 @@ def extract_video_info(video_id : String) params["reason"] = JSON::Any.new(reason) if reason if !CONFIG.invidious_companion.present? - new_player_response = nil - - # Don't use Android test suite client if po_token is passed because po_token doesn't - # work for Android test suite client. - if reason.nil? && CONFIG.po_token.nil? - # Fetch the video streams using an Android client in order to get the - # decrypted URLs and maybe fix throttling issues (#2194). See the - # following issue for an explanation about decrypted URLs: - # https://github.com/TeamNewPipe/NewPipeExtractor/issues/562 - client_config.client_type = YoutubeAPI::ClientType::AndroidTestSuite - new_player_response = try_fetch_streaming_data(video_id, client_config) - end - - # Replace player response and reset reason - if !new_player_response.nil? - # Preserve captions & storyboard data before replacement - new_player_response["storyboards"] = player_response["storyboards"] if player_response["storyboards"]? - new_player_response["captions"] = player_response["captions"] if player_response["captions"]? - - player_response = new_player_response - params.delete("reason") + if player_response["streamingData"]? && player_response.dig?("streamingData", "adaptiveFormats", 0, "url").nil? + LOGGER.warn("Missing URLs for adaptive formats, falling back to other YT clients.") + players_fallback = [YoutubeAPI::ClientType::WebMobile, YoutubeAPI::ClientType::TvHtml5] + players_fallback.each do |player_fallback| + client_config.client_type = player_fallback + player_fallback_response = try_fetch_streaming_data(video_id, client_config) + if player_fallback_response && player_fallback_response["streamingData"]? && + player_fallback_response.dig?("streamingData", "adaptiveFormats", 0, "url") + streaming_data = player_response["streamingData"].as_h + streaming_data["adaptiveFormats"] = player_fallback_response["streamingData"]["adaptiveFormats"] + player_response["streamingData"] = JSON::Any.new(streaming_data) + break + end + end end end From 8fd0b82c387dfd10f427c8267526223ba4dc1fce Mon Sep 17 00:00:00 2001 From: Alex Maras Date: Sat, 3 May 2025 07:28:18 +0800 Subject: [PATCH 4/7] feat: route to invidious companion on downloads (#5224) --- src/invidious/frontend/watch_page.cr | 8 +++++++- src/invidious/routes/watch.cr | 11 ++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/invidious/frontend/watch_page.cr b/src/invidious/frontend/watch_page.cr index 2e2f6ad0..15d925e3 100644 --- a/src/invidious/frontend/watch_page.cr +++ b/src/invidious/frontend/watch_page.cr @@ -23,10 +23,16 @@ module Invidious::Frontend::WatchPage return "

#{translate(locale, "Download is disabled")}

" end + url = "/download" + if (CONFIG.invidious_companion.present?) + invidious_companion = CONFIG.invidious_companion.sample + url = "#{invidious_companion.public_url}/download?check=#{invidious_companion_encrypt(video.id)}" + end + return String.build(4000) do |str| str << "" diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index ab588ad6..e777b3f1 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -293,6 +293,9 @@ module Invidious::Routes::Watch if CONFIG.disabled?("downloads") return error_template(403, "Administrator has disabled this endpoint.") end + if CONFIG.invidious_companion.present? + return error_template(403, "Downloads should be routed through Companion when present") + end title = env.params.body["title"]? || "" video_id = env.params.body["id"]? || "" @@ -328,13 +331,7 @@ module Invidious::Routes::Watch env.params.query["title"] = filename env.params.query["local"] = "true" - if (CONFIG.invidious_companion.present?) - video = get_video(video_id) - invidious_companion = CONFIG.invidious_companion.sample - return env.redirect "#{invidious_companion.public_url}/latest_version?#{env.params.query}" - else - return Invidious::Routes::VideoPlayback.latest_version(env) - end + return Invidious::Routes::VideoPlayback.latest_version(env) else return error_template(400, "Invalid label or itag") end From 2c1400c41e3236b9aa9c84cf73d5864090d52af6 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sat, 3 May 2025 22:28:19 +0200 Subject: [PATCH 5/7] Fix proxying live DASH streams (#4589) --- src/invidious/routes/video_playback.cr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/invidious/routes/video_playback.cr b/src/invidious/routes/video_playback.cr index b1c788c2..083087a9 100644 --- a/src/invidious/routes/video_playback.cr +++ b/src/invidious/routes/video_playback.cr @@ -21,7 +21,7 @@ module Invidious::Routes::VideoPlayback end # Sanity check, to avoid being used as an open proxy - if !host.matches?(/[\w-]+.googlevideo.com/) + if !host.matches?(/[\w-]+\.(?:googlevideo|c\.youtube)\.com/) return error_template(400, "Invalid \"host\" parameter.") end @@ -37,7 +37,8 @@ module Invidious::Routes::VideoPlayback # See: https://github.com/iv-org/invidious/issues/3302 range_header = env.request.headers["Range"]? - if range_header.nil? + sq = query_params["sq"]? + if range_header.nil? && sq.nil? range_for_head = query_params["range"]? || "0-640" headers["Range"] = "bytes=#{range_for_head}" end From 1f028fee0facfd51f1e2433ce808e2ea5198e2fd Mon Sep 17 00:00:00 2001 From: Vyquos <75266055+Vyquos@users.noreply.github.com> Date: Sun, 4 May 2025 07:47:42 +0000 Subject: [PATCH 6/7] Reflect companion secret character limit in example config comment (#5269) Update the comments in the example config to show that the companion secret key must be exactly 16 characters long as per https://github.com/iv-org/invidious-companion/pull/81#issuecomment-2750675405. --- config/config.example.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index d6119f29..8d3e6212 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -90,14 +90,14 @@ db: ## ## API key for Invidious companion, used for securing the communication ## between Invidious and Invidious companion. -## The size of the key needs to be more or equal to 16. +## The key needs to be exactly 16 characters long. ## ## Note: This parameter is mandatory when Invidious companion is enabled ## and should be a random string. ## Such random string can be generated on linux with the following ## command: `pwgen 16 1` ## -## Accepted values: a string +## Accepted values: a string (of length 16) ## Default: ## #invidious_companion_key: "CHANGE_ME!!" From d1bc15b8bffe7afad6000208dfe2cbd5601b4786 Mon Sep 17 00:00:00 2001 From: Emilien <4016501+unixfox@users.noreply.github.com> Date: Sun, 4 May 2025 11:59:42 +0200 Subject: [PATCH 7/7] Release v2.20250504.0 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f84dc790..c0718686 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## vX.Y.0 (future) +## v2.20250504.0 + +Small release with quick workaround fix for issue #4251 (Nil assertion failed). + +PR: https://github.com/iv-org/invidious/issues/5263 + ## v2.20250314.0 ### Wrap-up