summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorÉmilien Devos <contact@emiliendevos.be>2022-03-30 19:52:39 +0200
committerGitHub <noreply@github.com>2022-03-30 19:52:39 +0200
commitc152243b4d69191bcd672adbb55e7f7fb3c3ee2a (patch)
treec20853a5b4d0fdabf9ec99e7089470b80f5c74c0 /src
parent2a40c9a595006c6a62a10a542e4c408947de509c (diff)
downloadinvidious-c152243b4d69191bcd672adbb55e7f7fb3c3ee2a.tar.gz
invidious-c152243b4d69191bcd672adbb55e7f7fb3c3ee2a.tar.bz2
invidious-c152243b4d69191bcd672adbb55e7f7fb3c3ee2a.zip
new method for bypassing age restriction (#2996)
Diffstat (limited to 'src')
-rw-r--r--src/invidious/videos.cr4
-rw-r--r--src/invidious/yt_backend/youtube_api.cr7
2 files changed, 9 insertions, 2 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index 81fce5b8..b50e7b2c 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -585,7 +585,7 @@ struct Video
def allowed_regions
info
- .dig("microformat", "playerMicroformatRenderer", "availableCountries")
+ .dig?("microformat", "playerMicroformatRenderer", "availableCountries")
.try &.as_a.map &.as_s || [] of String
end
@@ -876,7 +876,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
client_config = YoutubeAPI::ClientConfig.new(proxy_region: proxy_region)
if context_screen == "embed"
- client_config.client_type = YoutubeAPI::ClientType::WebScreenEmbed
+ client_config.client_type = YoutubeAPI::ClientType::TvHtml5ScreenEmbed
end
player_response = YoutubeAPI.player(video_id: video_id, params: "", client_config: client_config)
diff --git a/src/invidious/yt_backend/youtube_api.cr b/src/invidious/yt_backend/youtube_api.cr
index d1b52a5a..2678ac6c 100644
--- a/src/invidious/yt_backend/youtube_api.cr
+++ b/src/invidious/yt_backend/youtube_api.cr
@@ -14,6 +14,7 @@ module YoutubeAPI
Android
AndroidEmbeddedPlayer
AndroidScreenEmbed
+ TvHtml5ScreenEmbed
end
# List of hard-coded values used by the different clients
@@ -60,6 +61,12 @@ module YoutubeAPI
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
screen: "EMBED",
},
+ ClientType::TvHtml5ScreenEmbed => {
+ name: "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
+ version: "2.0",
+ api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
+ screen: "EMBED",
+ },
}
####################################################################