Merge pull request #3252 from SamantazFox/bump-ytapi-clients

This commit is contained in:
Samantaz Fox 2022-08-07 01:15:49 +02:00
commit 945394fb1a
No known key found for this signature in database
GPG Key ID: F42821059186176E
1 changed files with 57 additions and 19 deletions

View File

@ -5,15 +5,27 @@
module YoutubeAPI module YoutubeAPI
extend self extend self
private DEFAULT_API_KEY = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"
private ANDROID_APP_VERSION = "17.29.35"
private IOS_APP_VERSION = "17.30.1"
# Enumerate used to select one of the clients supported by the API # Enumerate used to select one of the clients supported by the API
enum ClientType enum ClientType
Web Web
WebEmbeddedPlayer WebEmbeddedPlayer
WebMobile WebMobile
WebScreenEmbed WebScreenEmbed
Android Android
AndroidEmbeddedPlayer AndroidEmbeddedPlayer
AndroidScreenEmbed AndroidScreenEmbed
IOS
IOSEmbedded
IOSMusic
TvHtml5
TvHtml5ScreenEmbed TvHtml5ScreenEmbed
end end
@ -21,50 +33,76 @@ module YoutubeAPI
HARDCODED_CLIENTS = { HARDCODED_CLIENTS = {
ClientType::Web => { ClientType::Web => {
name: "WEB", name: "WEB",
version: "2.20210721.00.00", version: "2.20220804.07.00",
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", api_key: DEFAULT_API_KEY,
screen: "WATCH_FULL_SCREEN", screen: "WATCH_FULL_SCREEN",
}, },
ClientType::WebEmbeddedPlayer => { ClientType::WebEmbeddedPlayer => {
name: "WEB_EMBEDDED_PLAYER", # 56 name: "WEB_EMBEDDED_PLAYER", # 56
version: "1.20210721.1.0", version: "1.20220803.01.00",
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", api_key: DEFAULT_API_KEY,
screen: "EMBED", screen: "EMBED",
}, },
ClientType::WebMobile => { ClientType::WebMobile => {
name: "MWEB", name: "MWEB",
version: "2.20210726.08.00", version: "2.20220805.01.00",
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", api_key: DEFAULT_API_KEY,
screen: "", # None
}, },
ClientType::WebScreenEmbed => { ClientType::WebScreenEmbed => {
name: "WEB", name: "WEB",
version: "2.20210721.00.00", version: "2.20220804.00.00",
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", api_key: DEFAULT_API_KEY,
screen: "EMBED", screen: "EMBED",
}, },
# Android
ClientType::Android => { ClientType::Android => {
name: "ANDROID", name: "ANDROID",
version: "16.20", version: ANDROID_APP_VERSION,
api_key: "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w", api_key: "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w",
screen: "", # ??
}, },
ClientType::AndroidEmbeddedPlayer => { ClientType::AndroidEmbeddedPlayer => {
name: "ANDROID_EMBEDDED_PLAYER", # 55 name: "ANDROID_EMBEDDED_PLAYER", # 55
version: "16.20", version: ANDROID_APP_VERSION,
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", api_key: DEFAULT_API_KEY,
screen: "", # None?
}, },
ClientType::AndroidScreenEmbed => { ClientType::AndroidScreenEmbed => {
name: "ANDROID", # 3 name: "ANDROID", # 3
version: "16.20", version: ANDROID_APP_VERSION,
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", api_key: DEFAULT_API_KEY,
screen: "EMBED", screen: "EMBED",
}, },
# IOS
ClientType::IOS => {
name: "IOS", # 5
version: IOS_APP_VERSION,
api_key: "AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc",
},
ClientType::IOSEmbedded => {
name: "IOS_MESSAGES_EXTENSION", # 66
version: IOS_APP_VERSION,
api_key: DEFAULT_API_KEY,
},
ClientType::IOSMusic => {
name: "IOS_MUSIC", # 26
version: "4.32",
api_key: "AIzaSyBAETezhkwP0ZWA02RsqT1zu78Fpt0bC_s",
},
# TV app
ClientType::TvHtml5 => {
name: "TVHTML5", # 7
version: "7.20220325",
api_key: DEFAULT_API_KEY,
},
ClientType::TvHtml5ScreenEmbed => { ClientType::TvHtml5ScreenEmbed => {
name: "TVHTML5_SIMPLY_EMBEDDED_PLAYER", name: "TVHTML5_SIMPLY_EMBEDDED_PLAYER", # 85
version: "2.0", version: "2.0",
api_key: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", api_key: DEFAULT_API_KEY,
screen: "EMBED", screen: "EMBED",
}, },
} }
@ -131,7 +169,7 @@ module YoutubeAPI
# :ditto: # :ditto:
def screen : String def screen : String
HARDCODED_CLIENTS[@client_type][:screen] HARDCODED_CLIENTS[@client_type][:screen]? || ""
end end
# Convert to string, for logging purposes # Convert to string, for logging purposes