]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[letv] LetvCloud: guard against invalid URLs
authorYen Chi Hsuan <yan12125@gmail.com>
Tue, 19 Jan 2016 19:25:12 +0000 (03:25 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Tue, 19 Jan 2016 19:25:12 +0000 (03:25 +0800)
youtube_dl/extractor/letv.py

index be6c7596739b6521fa0ca2d9728e375b96d822f5..b8d4f5bb8ca02482504a9d8eca0a188542f311a1 100644 (file)
@@ -272,8 +272,14 @@ class LetvCloudIE(InfoExtractor):
     }]
 
     def _real_extract(self, url):
-        uu = re.search('uu=([\w]+)', url).group(1)
-        vu = re.search('vu=([\w]+)', url).group(1)
+        uu_mobj = re.search('uu=([\w]+)', url)
+        vu_mobj = re.search('vu=([\w]+)', url)
+
+        if not uu_mobj or not vu_mobj:
+            raise ExtractorError('Invalid URL: %s' % url, expected=True)
+
+        uu = uu_mobj.group(1)
+        vu = vu_mobj.group(1)
         media_id = uu + '_' + vu
 
         play_json_req = sanitized_Request(