From cb454b333d91718a0c2b36c34c8b0d6858ff9505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Wed, 28 Jan 2015 23:07:37 +0600 Subject: [PATCH] [generic] Improve some regexes --- youtube_dl/extractor/generic.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index a937a1e09..41884ed7a 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -874,15 +874,15 @@ def _playlist_from_matches(matches, getter=None, ie=None): return self.url_result(mobj.group('url')) # Look for embedded Viddler player - mobj = (re.search(r']+?src=(["\'])(?P(?:https?:)?//(?:www\.)?viddler\.com/embed/.+?)\1', webpage) or - re.search(r']+?value=(["\'])(?P(?:https?:)?//(?:www\.)?viddler\.com/player/.+?)\1', webpage)) - + mobj = re.search( + r'<(?:iframe[^>]+?src|param[^>]+?value)=(["\'])(?P(?:https?:)?//(?:www\.)?viddler\.com/(?:embed|player)/.+?)\1', + webpage) if mobj is not None: return self.url_result(mobj.group('url')) # Look for Ooyala videos - mobj = (re.search(r'player.ooyala.com/[^"?]+\?[^"]*?(?:embedCode|ec)=(?P[^"&]+)', webpage) or - re.search(r'OO.Player.create\([\'"].*?[\'"],\s*[\'"](?P.{32})[\'"]', webpage)) + mobj = (re.search(r'player\.ooyala\.com/[^"?]+\?[^"]*?(?:embedCode|ec)=(?P[^"&]+)', webpage) or + re.search(r'OO\.Player\.create\([\'"].*?[\'"],\s*[\'"](?P.{32})[\'"]', webpage)) if mobj is not None: return OoyalaIE._build_url_result(mobj.group('ec'))