diff options
| author | Émilien (perso) <4016501+unixfox@users.noreply.github.com> | 2024-09-16 23:42:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-16 23:42:43 +0200 |
| commit | de918b9234b99f91a0a364fc675533147581eb2e (patch) | |
| tree | 44a4260d9e840f4c52fb72fdbce2f7ef02ef1977 /src | |
| parent | 4782a6703819e0babfa4792892b691dd096eeac3 (diff) | |
| download | invidious-de918b9234b99f91a0a364fc675533147581eb2e.tar.gz invidious-de918b9234b99f91a0a364fc675533147581eb2e.tar.bz2 invidious-de918b9234b99f91a0a364fc675533147581eb2e.zip | |
use web screen embed for fixing potoken functionality (#4923)
* use web screen embed for fixing potoken functionality
* use web screen embed only for getting streamingData + disable tv screen on po_token
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/videos/parser.cr | 13 | ||||
| -rw-r--r-- | src/invidious/yt_backend/youtube_api.cr | 3 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index 95fa3d79..c17e596c 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -102,6 +102,12 @@ def extract_video_info(video_id : String) new_player_response = nil + # Use the WEB embed client when po_token is configured because it only works on this client + if CONFIG.po_token + client_config.client_type = YoutubeAPI::ClientType::WebEmbeddedPlayer + new_player_response = try_fetch_streaming_data(video_id, client_config) + end + # Don't use Android client if po_token is passed because po_token doesn't # work for Android client. if reason.nil? && CONFIG.po_token.nil? @@ -114,10 +120,9 @@ def extract_video_info(video_id : String) end # Last hope - # Only trigger if reason found and po_token or didn't work wth Android client. - # TvHtml5ScreenEmbed now requires sig helper for it to work but po_token is not required - # if the IP address is not blocked. - if CONFIG.po_token && reason || CONFIG.po_token.nil? && new_player_response.nil? + # Only trigger if reason found or didn't work wth Android client. + # TvHtml5ScreenEmbed now requires sig helper for it to work but doesn't work with po_token. + if reason && CONFIG.po_token.nil? client_config.client_type = YoutubeAPI::ClientType::TvHtml5ScreenEmbed new_player_response = try_fetch_streaming_data(video_id, client_config) end diff --git a/src/invidious/yt_backend/youtube_api.cr b/src/invidious/yt_backend/youtube_api.cr index d66bf7aa..6d6c72d1 100644 --- a/src/invidious/yt_backend/youtube_api.cr +++ b/src/invidious/yt_backend/youtube_api.cr @@ -291,8 +291,9 @@ module YoutubeAPI end if client_config.screen == "EMBED" + # embedUrl https://www.google.com allow loading video that are configured not embeddable client_context["thirdParty"] = { - "embedUrl" => "https://www.youtube.com/embed/#{video_id}", + "embedUrl" => "https://www.google.com/", } of String => String | Int64 end |
