mirror of
https://git.nerdvpn.de/NerdVPN.de/invidious
synced 2026-02-14 22:51:42 +01:00
use web client for fetching video data
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
From 50570aa603cfa90b7ec92009b80d10317e450346 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=89milien=20=28perso=29?=
|
||||
<4016501+unixfox@users.noreply.github.com>
|
||||
Date: Fri, 26 Apr 2024 08:29:23 +0000
|
||||
Subject: [PATCH 1/1] switch to WEB clien
|
||||
|
||||
---
|
||||
src/invidious/videos/parser.cr | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr
|
||||
index 75fe4a36..f8da7e1c 100644
|
||||
--- a/src/invidious/videos/parser.cr
|
||||
+++ b/src/invidious/videos/parser.cr
|
||||
@@ -107,11 +107,11 @@ def extract_video_info(video_id : String, proxy_region : String? = nil)
|
||||
# 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::Android
|
||||
+ client_config.client_type = YoutubeAPI::ClientType::Web
|
||||
new_player_response = try_fetch_streaming_data(video_id, client_config)
|
||||
elsif !reason.includes?("your country") # Handled separately
|
||||
# The Android embedded client could help here
|
||||
- client_config.client_type = YoutubeAPI::ClientType::AndroidScreenEmbed
|
||||
+ client_config.client_type = YoutubeAPI::ClientType::WebEmbeddedPlayer
|
||||
new_player_response = try_fetch_streaming_data(video_id, client_config)
|
||||
end
|
||||
|
||||
@@ -144,7 +144,7 @@ def try_fetch_streaming_data(id : String, client_config : YoutubeAPI::ClientConf
|
||||
LOGGER.debug("try_fetch_streaming_data: [#{id}] Using #{client_config.client_type} client.")
|
||||
# CgIIAdgDAQ%3D%3D is a workaround for streaming URLs that returns a 403.
|
||||
# https://github.com/LuanRT/YouTube.js/pull/624
|
||||
- response = YoutubeAPI.player(video_id: id, params: "CgIIAdgDAQ%3D%3D", client_config: client_config)
|
||||
+ response = YoutubeAPI.player(video_id: id, params: "2AMB", client_config: client_config)
|
||||
|
||||
playability_status = response["playabilityStatus"]["status"]
|
||||
LOGGER.debug("try_fetch_streaming_data: [#{id}] Got playabilityStatus == #{playability_status}.")
|
||||
--
|
||||
2.44.0
|
||||
|
||||
Reference in New Issue
Block a user