use web screen embed for fixing potoken functionality

This commit is contained in:
Emilien Devos 2024-09-16 22:41:30 +02:00
parent 4782a67038
commit cae653cdd8
2 changed files with 4 additions and 1 deletions

View file

@ -53,6 +53,8 @@ end
def extract_video_info(video_id : String) def extract_video_info(video_id : String)
# Init client config for the API # Init client config for the API
client_config = YoutubeAPI::ClientConfig.new client_config = YoutubeAPI::ClientConfig.new
# use WEB screen embed for potoken functionality
client_config.client_type = YoutubeAPI::ClientType::WebEmbeddedPlayer
# Fetch data from the player endpoint # Fetch data from the player endpoint
player_response = YoutubeAPI.player(video_id: video_id, params: "2AMB", client_config: client_config) player_response = YoutubeAPI.player(video_id: video_id, params: "2AMB", client_config: client_config)

View file

@ -291,8 +291,9 @@ module YoutubeAPI
end end
if client_config.screen == "EMBED" if client_config.screen == "EMBED"
# embedUrl https://www.google.com allow loading video that are configured not embeddable
client_context["thirdParty"] = { client_context["thirdParty"] = {
"embedUrl" => "https://www.youtube.com/embed/#{video_id}", "embedUrl" => "https://www.google.com/",
} of String => String | Int64 } of String => String | Int64
end end