From: Philipp Hagemeister Date: Wed, 30 Apr 2014 00:23:51 +0000 (+0200) Subject: [generic] Allow multiple matches for generic hits (Fixes #2818) X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=b30b8698ea11e85079cc9e392cdf26f4e61671c4;p=youtube-dl [generic] Allow multiple matches for generic hits (Fixes #2818) --- diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index cfb009d79..58092da38 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -637,70 +637,77 @@ class GenericIE(InfoExtractor): return self.url_result(smotri_url, 'Smotri') # Start with something easy: JW Player in SWFObject - mobj = re.search(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage) - if mobj is None: + found = re.findall(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage) + if not found: # Look for gorilla-vid style embedding - mobj = re.search(r'''(?sx) + found = re.findall(r'''(?sx) (?: jw_plugins| JWPlayerOptions| jwplayer\s*\(\s*["'][^'"]+["']\s*\)\s*\.setup ) .*?file\s*:\s*["\'](.*?)["\']''', webpage) - if mobj is None: + if not found: # Broaden the search a little bit - mobj = re.search(r'[^A-Za-z0-9]?(?:file|source)=(http[^\'"&]*)', webpage) - if mobj is None: - # Broaden the search a little bit: JWPlayer JS loader - mobj = re.search(r'[^A-Za-z0-9]?file["\']?:\s*["\'](http(?![^\'"]+\.[0-9]+[\'"])[^\'"]+)["\']', webpage) - - if mobj is None: + found = re.findall(r'[^A-Za-z0-9]?(?:file|source)=(http[^\'"&]*)', webpage) + if not found: + # Broaden the findall a little bit: JWPlayer JS loader + found = re.findall(r'[^A-Za-z0-9]?file["\']?:\s*["\'](http(?![^\'"]+\.[0-9]+[\'"])[^\'"]+)["\']', webpage) + if not found: # Try to find twitter cards info - mobj = re.search(r'.*?.*?