[addanime] better regex.
authorAbdulelah Alfntokh <iAbdulelah@Gmail.com>
Sun, 27 Oct 2013 16:48:02 +0000 (19:48 +0300)
committerAbdulelah Alfntokh <iAbdulelah@Gmail.com>
Sun, 27 Oct 2013 16:48:02 +0000 (19:48 +0300)
youtube_dl/extractor/addanime.py

index 490b5af627372199a82f214c8081ef18be4baa44..465df8cf081b3fe68eaef21eea1f01cd4ca124ce 100644 (file)
@@ -8,7 +8,6 @@ from ..utils import (
     compat_urllib_parse_urlparse,
 
     ExtractorError,
-    RegexNotFoundError,
 )
 
 
@@ -61,12 +60,8 @@ class AddAnimeIE(InfoExtractor):
                 note=u'Confirming after redirect')
             webpage = self._download_webpage(url, video_id)
 
-        try:
-            video_url = self._search_regex(r"var hq_video_file = '(.*?)';",
-                                           webpage, u'video file URL')
-        except RegexNotFoundError:
-            video_url = self._search_regex(r"var normal_video_file = '(.*?)';",
-                                           webpage, u'video file URL')
+        video_url = self._search_regex(r"var (?:hq|normal)_video_file = '(.*?)';",
+                                       webpage, u'video file URL')
         
         video_extension = video_url[-3:]  # mp4 or flv ?
         video_title = self._og_search_title(webpage)