From 7e2ede9891543c9ca85628b064f5e619e22d9597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Sat, 22 Mar 2014 10:20:44 +0100 Subject: [PATCH] [generic] Run TED detection before JW Player detection Otherwise it overwrittes the `mobj` variable. --- youtube_dl/extractor/generic.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index 238913256..4d649fe71 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -519,6 +519,12 @@ def _real_extract(self, url): if rutv_url: return self.url_result(rutv_url, 'RUTV') + # Look for embedded TED player + mobj = re.search( + r']+?src=(["\'])(?Phttp://embed\.ted\.com/.+?)\1', webpage) + if mobj is not None: + return self.url_result(mobj.group('url'), 'TED') + # Start with something easy: JW Player in SWFObject mobj = re.search(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage) if mobj is None: @@ -531,12 +537,6 @@ def _real_extract(self, url): # Broaden the search a little bit: JWPlayer JS loader mobj = re.search(r'[^A-Za-z0-9]?file["\']?:\s*["\'](http(?![^\'"]+\.[0-9]+[\'"])[^\'"]+)["\']', webpage) - # Look for embedded TED player - mobj = re.search( - r']+?src=(["\'])(?Phttp://embed\.ted\.com/.+?)\1', webpage) - if mobj is not None: - return self.url_result(mobj.group('url'), 'TED') - if mobj is None: # Try to find twitter cards info mobj = re.search(r'