Skip to content

Commit

Permalink
apparently Google has a separate URL for YouTube w/no cookies at www.…
Browse files Browse the repository at this point in the history
…youtube-nocookie.com; whois verifies that it's a Google domain, so I've added support for it -- embedded YouTube NoCookie flash views will work correctly with H.264 variants now
  • Loading branch information
Simone Manganelli authored and Simone Manganelli committed Jul 30, 2009
1 parent 760a889 commit dc5bf53
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Plugin/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,11 @@ - (id) initWithArguments:(NSDictionary *)arguments
// check whether it's from YouTube and get the video_id

_fromYouTube = [[self host] isEqualToString:@"www.youtube.com"]
|| [[self host] isEqualToString:@"www.youtube-nocookie.com"]
|| ( flashvars != nil && [flashvars rangeOfString: @"www.youtube.com"].location != NSNotFound )
|| ([self src] != nil && [[self src] rangeOfString: @"youtube.com"].location != NSNotFound );
|| ( flashvars != nil && [flashvars rangeOfString: @"www.youtube-nocookie.com"].location != NSNotFound )
|| ([self src] != nil && [[self src] rangeOfString: @"youtube.com"].location != NSNotFound )
|| ([self src] != nil && [[self src] rangeOfString: @"youtube-nocookie.com"].location != NSNotFound );

if (_fromYouTube) {
NSString *videoId = [ self flashvarWithName: @"video_id" ];
Expand All @@ -219,6 +222,13 @@ - (id) initWithArguments:(NSDictionary *)arguments

[URLScanner scanUpToString:@"&" intoString:&videoIdFromURL];
if (videoIdFromURL) [self setVideoId:videoIdFromURL];
} else {
[URLScanner setScanLocation:0];
[URLScanner scanUpToString:@"youtube-nocookie.com/v/" intoString:nil];
if ([URLScanner scanString:@"youtube-nocookie.com/v/" intoString:nil]) {
[URLScanner scanUpToString:@"&" intoString:&videoIdFromURL];
if (videoIdFromURL) [self setVideoId:videoIdFromURL];
}
}
[URLScanner release];

Expand Down

0 comments on commit dc5bf53

Please sign in to comment.