Skip to content

Commit

Permalink
Improve handling of embedded YouTube.
Browse files Browse the repository at this point in the history
We were scanning for »var swfArgs = {« but that seems to fail on quite a few pages I saw last week. (e.g.:
http://www.fscklog.com/2009/10/drei-neue-get-a-mac-ads-zum-start-von-windows-7-videos.html
http://www.scienceblogs.de/mathlog/2009/10/mathematik-zum-anfassen-auf-youtube.php
http://www.fakesteve.net/2009/10/mosspuppet-claims-hes-sabotaged.html

It looks like the flashvars are stored after a »'SWF_ARGS': {« for those, so I'm scanning for that as well now.

A general YouTube change, perhaps? Does the old string still occur?
  • Loading branch information
ssp authored and simX committed Nov 6, 2009
1 parent b579bdb commit a36b987
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Plugin/CTFKillerYouTube.m
Expand Up @@ -315,9 +315,16 @@ - (NSDictionary*) _flashVarDictionaryFromYouTubePageHTML: (NSString*) youTubePag
NSMutableDictionary* flashVarsDictionary = [ NSMutableDictionary dictionary ];
NSScanner *HTMLScanner = [[NSScanner alloc] initWithString:youTubePageHTML];

[HTMLScanner scanUpToString:@"var swfArgs = {" intoString:nil];
[HTMLScanner scanUpToString:@"var swfArgs = {" intoString: nil];
BOOL swfArgsFound = [HTMLScanner scanString:@"var swfArgs = {" intoString:nil];

if (!swfArgsFound) {
// the magic words seems to be SWF_ARGS in places (or now?)
[HTMLScanner setScanLocation:0];
[HTMLScanner scanUpToString:@"'SWF_ARGS': {" intoString: nil];
swfArgsFound = [HTMLScanner scanString:@"'SWF_ARGS': {" intoString:nil];
}


if (swfArgsFound) {
NSString *swfArgsString = nil;
[HTMLScanner scanUpToString:@"}" intoString:&swfArgsString];
Expand Down

0 comments on commit a36b987

Please sign in to comment.