mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-01-11 22:40:19 +00:00
Update Extractor.xm
This commit is contained in:
parent
160d9f3a85
commit
333d512637
1 changed files with 15 additions and 18 deletions
|
|
@ -1,31 +1,28 @@
|
|||
// Extractor.xm was made by @LillieH1000 from https://www.github.com/LillieH1000/YouTube-Reborn
|
||||
// Extractor.xm was made by @LillieH1000 from https://github.com/LillieH1000/YouTube-Reborn/commit/bb858715235b1c2ce8793631bc34b51dfed491ef
|
||||
|
||||
#import "Extractor.h"
|
||||
|
||||
@implementation Extractor
|
||||
@implementation YouTubeExtractor
|
||||
|
||||
+ (NSDictionary *)youtubePlayerRequest :(NSString *)client :(NSString *)videoID {
|
||||
+ (NSDictionary *)youtubePlayerRequest :(NSString *)clientId :(NSString *)videoId {
|
||||
NSLocale *locale = [NSLocale currentLocale];
|
||||
NSString *countryCode = [locale objectForKey:NSLocaleCountryCode];
|
||||
|
||||
NSURL *requestURL;
|
||||
if ([client isEqual:@"android"]) {
|
||||
requestURL = [NSURL URLWithString:@"https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&prettyPrint=false"];
|
||||
} else if ([client isEqual:@"ios"]) {
|
||||
requestURL = [NSURL URLWithString:@"https://www.youtube.com/youtubei/v1/player?key=AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc&prettyPrint=false"];
|
||||
NSString *innertubeKey;
|
||||
NSString *jsonBody;
|
||||
if ([clientId isEqual:@"mediaconnect"]) {
|
||||
innertubeKey = @"AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w";
|
||||
jsonBody = [NSString stringWithFormat:@"{\"context\":{\"client\":{\"hl\":\"en\",\"gl\":\"%@\",\"clientName\":\"MEDIA_CONNECT_FRONTEND\",\"clientVersion\":\"0.1\"}},\"contentCheckOk\":true,\"racyCheckOk\":true,\"videoId\":\"%@\"}", countryCode, videoId];
|
||||
}
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL];
|
||||
if ([clientId isEqual:@"ios"]) {
|
||||
innertubeKey = @"AAIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc";
|
||||
jsonBody = [NSString stringWithFormat:@"{\"context\":{\"client\":{\"hl\":\"en\",\"gl\":\"%@\",\"clientName\":\"IOS\",\"clientVersion\":\"19.09.3\",\"deviceModel\":\"iPhone14,3\"}},\"contentCheckOk\":true,\"racyCheckOk\":true,\"videoId\":\"%@\"}", countryCode, videoId];
|
||||
}
|
||||
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://www.youtube.com/youtubei/v1/player?key=%@&prettyPrint=false", innertubeKey]]];
|
||||
[request setHTTPMethod:@"POST"];
|
||||
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
||||
if ([client isEqual:@"android"]) {
|
||||
[request setValue:@"com.google.android.youtube/19.05.36 (Linux; U; Android 11) gzip" forHTTPHeaderField:@"User-Agent"];
|
||||
NSString *jsonBody = [NSString stringWithFormat:@"{\"context\":{\"client\":{\"hl\":\"en\",\"gl\":\"%@\",\"clientName\":\"ANDROID\",\"clientVersion\":\"19.05.36\",\"androidSdkVersion\":30,\"playbackContext\":{\"contentPlaybackContext\":{\"vis\":0,\"splay\":false,\"autoCaptionsDefaultOn\":false,\"autonavState\":\"STATE_OFF\",\"signatureTimestamp\":\"sts\",\"html5Preference\":\"HTML5_PREF_WANTS\",\"lactMilliseconds\":\"-1\"}}}},\"contentCheckOk\":true,\"racyCheckOk\":true,\"videoId\":\"%@\"}", countryCode, videoID];
|
||||
[request setHTTPBody:[jsonBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]];
|
||||
} else if ([client isEqual:@"ios"]) {
|
||||
[request setValue:@"com.google.ios.youtube/19.06.2 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)" forHTTPHeaderField:@"User-Agent"];
|
||||
NSString *jsonBody = [NSString stringWithFormat:@"{\"context\":{\"client\":{\"hl\":\"en\",\"gl\":\"%@\",\"clientName\":\"IOS\",\"clientVersion\":\"19.06.2\",\"deviceModel\":\"iPhone14,3\",\"playbackContext\":{\"contentPlaybackContext\":{\"vis\":0,\"splay\":false,\"autoCaptionsDefaultOn\":false,\"autonavState\":\"STATE_OFF\",\"signatureTimestamp\":\"sts\",\"html5Preference\":\"HTML5_PREF_WANTS\",\"lactMilliseconds\":\"-1\"}}}},\"contentCheckOk\":true,\"racyCheckOk\":true,\"videoId\":\"%@\"}", countryCode, videoID];
|
||||
[request setHTTPBody:[jsonBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]];
|
||||
}
|
||||
[request setHTTPBody:[jsonBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]];
|
||||
|
||||
__block NSData *requestData;
|
||||
__block BOOL requestFinished = NO;
|
||||
|
|
|
|||
Loading…
Reference in a new issue