new method for bypassing age restriction (#2996)
This commit is contained in:
parent
2a40c9a595
commit
c152243b4d
2 changed files with 9 additions and 2 deletions
|
@ -585,7 +585,7 @@ struct Video
|
||||||
|
|
||||||
def allowed_regions
|
def allowed_regions
|
||||||
info
|
info
|
||||||
.dig("microformat", "playerMicroformatRenderer", "availableCountries")
|
.dig?("microformat", "playerMicroformatRenderer", "availableCountries")
|
||||||
.try &.as_a.map &.as_s || [] of String
|
.try &.as_a.map &.as_s || [] of String
|
||||||
end
|
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)
|
client_config = YoutubeAPI::ClientConfig.new(proxy_region: proxy_region)
|
||||||
if context_screen == "embed"
|
if context_screen == "embed"
|
||||||
client_config.client_type = YoutubeAPI::ClientType::WebScreenEmbed
|
client_config.client_type = YoutubeAPI::ClientType::TvHtml5ScreenEmbed
|
||||||
end
|
end
|
||||||
|
|
||||||
player_response = YoutubeAPI.player(video_id: video_id, params: "", client_config: client_config)
|
player_response = YoutubeAPI.player(video_id: video_id, params: "", client_config: client_config)
|
||||||
|
|
|
@ -14,6 +14,7 @@ module YoutubeAPI
|
||||||
Android
|
Android
|
||||||
AndroidEmbeddedPlayer
|
AndroidEmbeddedPlayer
|
||||||
AndroidScreenEmbed
|
AndroidScreenEmbed
|
||||||
|
TvHtml5ScreenEmbed
|
||||||
end
|
end
|
||||||
|
|
||||||
# List of hard-coded values used by the different clients
|
# List of hard-coded values used by the different clients
|
||||||
|
@ -60,6 +61,12 @@ module YoutubeAPI
|
||||||
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
|
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
|
||||||
screen: "EMBED",
|
screen: "EMBED",
|
||||||
},
|
},
|
||||||
|
ClientType::TvHtml5ScreenEmbed => {
|
||||||
|
name: "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
|
||||||
|
version: "2.0",
|
||||||
|
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
|
||||||
|
screen: "EMBED",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
Loading…
Reference in a new issue