summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-08-21 13:25:17 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-08-21 13:25:17 +0200
commit12c3ec3382c2eace1afe1840da4f91939bd6b785 (patch)
treed384eeb73d71f051ca7f15515d8a8f57a7c7945a
parent55db73efdf1860bbd24b8556fbefd2ba6263a2cf (diff)
downloadyoutube-dl-12c3ec3382c2eace1afe1840da4f91939bd6b785.tar.gz
youtube-dl-12c3ec3382c2eace1afe1840da4f91939bd6b785.tar.xz
youtube-dl-12c3ec3382c2eace1afe1840da4f91939bd6b785.zip
[metacafe] Simplify
-rw-r--r--youtube_dl/extractor/metacafe.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/youtube_dl/extractor/metacafe.py b/youtube_dl/extractor/metacafe.py
index 6436c05a3..c3a4a333c 100644
--- a/youtube_dl/extractor/metacafe.py
+++ b/youtube_dl/extractor/metacafe.py
@@ -152,10 +152,9 @@ class MetacafeIE(InfoExtractor):
                 video_url = mobj.group(1)
                 video_ext = 'mp4'
             else:
-                mobj = re.search(r' name="flashvars" value="(.*?)"', webpage)
-                if mobj is None:
-                    raise ExtractorError('Unable to extract media URL')
-                vardict = compat_parse_qs(mobj.group(1))
+                flashvars = self._search_regex(
+                    r' name="flashvars" value="(.*?)"', webpage, 'flashvars')
+                vardict = compat_parse_qs(flashvars)
                 if 'mediaData' not in vardict:
                     raise ExtractorError('Unable to extract media URL')
                 mobj = re.search(
@@ -166,7 +165,8 @@ class MetacafeIE(InfoExtractor):
                 video_url = '%s?__gda__=%s' % (mediaURL, mobj.group('key'))
                 video_ext = determine_ext(video_url)
 
-        video_title = self._html_search_regex(r'(?im)<title>(.*) - Video</title>', webpage, 'title')
+        video_title = self._html_search_regex(
+            r'(?im)<title>(.*) - Video</title>', webpage, 'title')
         description = self._og_search_description(webpage)
         thumbnail = self._og_search_thumbnail(webpage)
         video_uploader = self._html_search_regex(
@@ -184,7 +184,7 @@ class MetacafeIE(InfoExtractor):
             'description': description,
             'uploader': video_uploader,
             'title': video_title,
-            'thumbnail':thumbnail,
+            'thumbnail': thumbnail,
             'ext': video_ext,
             'age_limit': age_limit,
         }