diff options
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | config/config.example.yml | 7 | ||||
| -rw-r--r-- | src/invidious/config.cr | 2 | ||||
| -rw-r--r-- | src/invidious/routes/feeds.cr | 6 | ||||
| -rw-r--r-- | src/invidious/user/cookies.cr | 4 | ||||
| -rw-r--r-- | src/invidious/yt_backend/youtube_api.cr | 99 |
6 files changed, 93 insertions, 34 deletions
@@ -20,7 +20,7 @@ <a href="https://hosted.weblate.org/engage/invidious/"> <img alt="Translation Status" src="https://hosted.weblate.org/widgets/invidious/-/translations/svg-badge.svg"> </a> - + <a href="https://github.com/humanetech-community/awesome-humane-tech"> <img alt="Awesome Humane Tech" src="https://raw.githubusercontent.com/humanetech-community/awesome-humane-tech/main/humane-tech-badge.svg?sanitize=true"> </a> @@ -28,17 +28,17 @@ <h3>An open source alternative front-end to YouTube</h3> <a href="https://invidious.io/">Website</a> - • + • <a href="https://instances.invidious.io/">Instances list</a> • <a href="https://docs.invidious.io/faq/">FAQ</a> - • + • <a href="https://docs.invidious.io/">Documentation</a> • <a href="#contribute">Contribute</a> • <a href="https://invidious.io/donate/">Donate</a> - + <h5>Chat with us:</h5> <a href="https://matrix.to/#/#invidious:matrix.org"> <img alt="Matrix" src="https://img.shields.io/matrix/invidious:matrix.org?label=Matrix&color=darkgreen"> @@ -153,6 +153,7 @@ Weblate also allows you to log-in with major SSO providers like Github, Gitlab, - [WatchTube](https://github.com/WatchTubeTeam/WatchTube): Powerful YouTube client for Apple Watch. - [Yattee](https://github.com/yattee/yattee): Alternative YouTube frontend for iPhone, iPad, Mac and Apple TV. - [TubiTui](https://codeberg.org/777/TubiTui): A lightweight, libre, TUI-based YouTube client. +- [Ytfzf](https://github.com/pystardust/ytfzf): A posix script to find and watch youtube videos from the terminal. (Without API) ## Liability diff --git a/config/config.example.yml b/config/config.example.yml index 3e8faf20..10734c3a 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -352,10 +352,13 @@ feed_threads: 1 ## Note: This part of the code generate a small amount of data every minute. ## This may not be desired if you have bandwidth limits set by your ISP. ## +## Note 2: This part of the code is currently broken, so changing +## this setting has no impact. +## ## Accepted values: true, false -## Default: true +## Default: false ## -#decrypt_polling: true +#decrypt_polling: false # ----------------------------- diff --git a/src/invidious/config.cr b/src/invidious/config.cr index a077c7fd..786b65df 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -75,7 +75,7 @@ class Config @[YAML::Field(converter: Preferences::URIConverter)] property database_url : URI = URI.parse("") # Use polling to keep decryption function up to date - property decrypt_polling : Bool = true + property decrypt_polling : Bool = false # Used for crawling channels: threads should check all videos uploaded by a channel property full_refresh : Bool = false # Used to tell Invidious it is behind a proxy, so links to resources should be https:// diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr index 44a87175..b601db94 100644 --- a/src/invidious/routes/feeds.cr +++ b/src/invidious/routes/feeds.cr @@ -204,6 +204,12 @@ module Invidious::Routes::Feeds xml.element("uri") { xml.text "#{HOST_URL}/channel/#{channel.ucid}" } end + xml.element("image") do + xml.element("url") { xml.text channel.author_thumbnail } + xml.element("title") { xml.text channel.author } + xml.element("link", rel: "self", href: "#{HOST_URL}#{env.request.resource}") + end + videos.each do |video| video.to_xml(channel.auto_generated, params, xml) end diff --git a/src/invidious/user/cookies.cr b/src/invidious/user/cookies.cr index 65e079ec..654efc15 100644 --- a/src/invidious/user/cookies.cr +++ b/src/invidious/user/cookies.cr @@ -18,7 +18,7 @@ struct Invidious::User expires: Time.utc + 2.years, secure: SECURE, http_only: true, - samesite: HTTP::Cookie::SameSite::Strict + samesite: HTTP::Cookie::SameSite::Lax ) end @@ -32,7 +32,7 @@ struct Invidious::User expires: Time.utc + 2.years, secure: SECURE, http_only: false, - samesite: HTTP::Cookie::SameSite::Strict + samesite: HTTP::Cookie::SameSite::Lax ) end end diff --git a/src/invidious/yt_backend/youtube_api.cr b/src/invidious/yt_backend/youtube_api.cr index 2678ac6c..30d7613b 100644 --- a/src/invidious/yt_backend/youtube_api.cr +++ b/src/invidious/yt_backend/youtube_api.cr @@ -5,15 +5,28 @@ module YoutubeAPI extend self + private DEFAULT_API_KEY = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8" + + private ANDROID_APP_VERSION = "17.29.35" + private ANDROID_SDK_VERSION = 30_i64 + private IOS_APP_VERSION = "17.30.1" + # Enumerate used to select one of the clients supported by the API enum ClientType Web WebEmbeddedPlayer WebMobile WebScreenEmbed + Android AndroidEmbeddedPlayer AndroidScreenEmbed + + IOS + IOSEmbedded + IOSMusic + + TvHtml5 TvHtml5ScreenEmbed end @@ -21,50 +34,78 @@ module YoutubeAPI HARDCODED_CLIENTS = { ClientType::Web => { name: "WEB", - version: "2.20210721.00.00", - api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", + version: "2.20220804.07.00", + api_key: DEFAULT_API_KEY, screen: "WATCH_FULL_SCREEN", }, ClientType::WebEmbeddedPlayer => { name: "WEB_EMBEDDED_PLAYER", # 56 - version: "1.20210721.1.0", - api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", + version: "1.20220803.01.00", + api_key: DEFAULT_API_KEY, screen: "EMBED", }, ClientType::WebMobile => { name: "MWEB", - version: "2.20210726.08.00", - api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", - screen: "", # None + version: "2.20220805.01.00", + api_key: DEFAULT_API_KEY, }, ClientType::WebScreenEmbed => { name: "WEB", - version: "2.20210721.00.00", - api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", + version: "2.20220804.00.00", + api_key: DEFAULT_API_KEY, screen: "EMBED", }, + + # Android + ClientType::Android => { - name: "ANDROID", - version: "16.20", - api_key: "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w", - screen: "", # ?? + name: "ANDROID", + version: ANDROID_APP_VERSION, + api_key: "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w", + android_sdk_version: ANDROID_SDK_VERSION, }, ClientType::AndroidEmbeddedPlayer => { name: "ANDROID_EMBEDDED_PLAYER", # 55 - version: "16.20", - api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", - screen: "", # None? + version: ANDROID_APP_VERSION, + api_key: DEFAULT_API_KEY, }, ClientType::AndroidScreenEmbed => { - name: "ANDROID", # 3 - version: "16.20", - api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", - screen: "EMBED", + name: "ANDROID", # 3 + version: ANDROID_APP_VERSION, + api_key: DEFAULT_API_KEY, + screen: "EMBED", + android_sdk_version: ANDROID_SDK_VERSION, + }, + + # IOS + + ClientType::IOS => { + name: "IOS", # 5 + version: IOS_APP_VERSION, + api_key: "AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc", + }, + ClientType::IOSEmbedded => { + name: "IOS_MESSAGES_EXTENSION", # 66 + version: IOS_APP_VERSION, + api_key: DEFAULT_API_KEY, + }, + ClientType::IOSMusic => { + name: "IOS_MUSIC", # 26 + version: "4.32", + api_key: "AIzaSyBAETezhkwP0ZWA02RsqT1zu78Fpt0bC_s", + }, + + # TV app + + ClientType::TvHtml5 => { + name: "TVHTML5", # 7 + version: "7.20220325", + api_key: DEFAULT_API_KEY, }, ClientType::TvHtml5ScreenEmbed => { - name: "TVHTML5_SIMPLY_EMBEDDED_PLAYER", + name: "TVHTML5_SIMPLY_EMBEDDED_PLAYER", # 85 version: "2.0", - api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", + api_key: DEFAULT_API_KEY, screen: "EMBED", }, } @@ -131,7 +172,11 @@ module YoutubeAPI # :ditto: def screen : String - HARDCODED_CLIENTS[@client_type][:screen] + HARDCODED_CLIENTS[@client_type][:screen]? || "" + end + + def android_sdk_version : Int64? + HARDCODED_CLIENTS[@client_type][:android_sdk_version]? end # Convert to string, for logging purposes @@ -163,7 +208,7 @@ module YoutubeAPI "gl" => client_config.region || "US", # Can't be empty! "clientName" => client_config.name, "clientVersion" => client_config.version, - }, + } of String => String | Int64, } # Add some more context if it exists in the client definitions @@ -174,7 +219,11 @@ module YoutubeAPI if client_config.screen == "EMBED" client_context["thirdParty"] = { "embedUrl" => "https://www.youtube.com/embed/dQw4w9WgXcQ", - } + } of String => String | Int64 + end + + if android_sdk_version = client_config.android_sdk_version + client_context["client"]["androidSdkVersion"] = android_sdk_version end return client_context |
