-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathYoutubeClientType.m
More file actions
116 lines (105 loc) · 3.9 KB
/
YoutubeClientType.m
File metadata and controls
116 lines (105 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#import "YoutubeClientType.h"
#include <Foundation/Foundation.h>
@implementation YoutubeClientType
+(YoutubeClientType*)webClient {
YoutubeClientType *client = [[YoutubeClientType alloc] init];
client.name = @"web";
client.nameProto = @"1";
client.version = @"2.20250222.10.00";
client.screen = @"WATCH_FULL_SCREEN";
client.osName = @"Windows";
client.osVersion = @"10.0";
client.platform = @"DESKTOP";
return client;
}
// apparently doesn't need POToken with HLS
+(YoutubeClientType*)webSafariClient {
YoutubeClientType *client = [[YoutubeClientType alloc] init];
client.name = @"web";
client.nameProto = @"1";
client.version = @"2.20250222.10.00";
client.useragent = @"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15,gzip(gfe)";
client.screen = @"WATCH_FULL_SCREEN";
return client;
}
+(YoutubeClientType*)webMobileClient {
YoutubeClientType *client = [[YoutubeClientType alloc] init];
client.name = @"mweb";
client.nameProto = @"2";
client.version = @"2.20251222.01.00";
client.osName = @"iOS";
client.osVersion = @"18";
client.platform = @"MOBILE";
return client;
}
// +(YoutubeClientType*)webMobileClient {
// YoutubeClientType *client = [[YoutubeClientType alloc] init];
// client.name = @"mweb";
// client.nameProto = @"2";
// client.version = @"2.20250224.01.00";
// client.osName = @"Android";
// client.osVersion = @"11";
// client.platform = @"MOBILE";
// return client;
// }
+(YoutubeClientType*)androidClient {
YoutubeClientType *client = [[YoutubeClientType alloc] init];
client.name = @"ANDROID";
client.version = @"20.10.38";
client.osName = @"Android";
client.osVersion = @"11";
client.platform = @"MOBILE";
return client;
}
+(YoutubeClientType*)androidVrClient {
YoutubeClientType *client = [[YoutubeClientType alloc] init];
client.name = @"ANDROID_VR";
client.version = @"1.60.19";
client.osName = @"Oculus";
client.osVersion = @"12L";
client.platform = @"MOBILE";
return client;
}
+(YoutubeClientType*)iosClient {
YoutubeClientType *client = [[YoutubeClientType alloc] init];
client.name = @"IOS";
client.version = @"21.08.3";
client.osName = @"iPhone";
client.osVersion = @"18.5.0.22F76";
client.platform = @"MOBILE";
return client;
}
+(YoutubeClientType*)tvEmbeddedClient {
YoutubeClientType *client = [[YoutubeClientType alloc] init];
client.name = @"TVHTML5_SIMPLY_EMBEDDED_PLAYER";
client.version = @"2.0";
client.osName = @"Android";
client.osVersion = @"11";
client.platform = @"TV";
return client;
}
-(NSDictionary*)makeContext {
NSMutableDictionary *clientContext = [[NSMutableDictionary alloc] init];
[clientContext setObject:@"en" forKey:@"hl"]; //[[NSLocale preferredLanguages] objectAtIndex:0] forKey:@"hl"]; // so this also localizes a few other things, like time :)
[clientContext setObject:[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] forKey:@"gl"];
[clientContext setObject:[self name] forKey:@"clientName"];
[clientContext setObject:[self version] forKey:@"clientVersion"];
if ([self osName]) {
[clientContext setObject:[self osName] forKey:@"osName"];
}
if ([self osVersion]) {
[clientContext setObject:[self osVersion] forKey:@"osVersion"];
}
if ([self platform]) {
[clientContext setObject:[self platform] forKey:@"platform"];
}
if ([self useragent]) {
[clientContext setObject:[self useragent] forKey:@"userAgent"];
}
if ([self configData]) {
[clientContext setObject:[self configData] forKey:@"configData"];
}
// there is more, but hopefully this will be fine for now?
return @{@"client":clientContext};
}
@end