Skip to content

Commit

Permalink
Add cookie similar to youtube-dl
Browse files Browse the repository at this point in the history
  • Loading branch information
SoneeJohn authored and dpwilhelmsen committed Jun 19, 2021
1 parent 9362352 commit 12f6a1c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions XCDYouTubeKit/XCDYouTubeVideoOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ - (instancetype) initWithVideoIdentifier:(NSString *)videoIdentifier languageIde
for (NSHTTPCookie *cookie in _cookies) {
[_session.configuration.HTTPCookieStorage setCookie:cookie];
}

NSString *cookieValue = [NSString stringWithFormat:@"f1=50000000&f6=8&hl=%@", _languageIdentifier];

NSHTTPCookie *additionalCookie = [NSHTTPCookie cookieWithProperties:@{
NSHTTPCookiePath: @"/",
NSHTTPCookieName: @"PREF",
NSHTTPCookieValue: cookieValue,
NSHTTPCookieDomain:@".youtube.com",
NSHTTPCookieSecure:@"TRUE"
}];

[_session.configuration.HTTPCookieStorage setCookie:additionalCookie];
_operationStartSemaphore = dispatch_semaphore_create(0);

return self;
Expand Down

0 comments on commit 12f6a1c

Please sign in to comment.