[mwave] Coding style
authorYen Chi Hsuan <yan12125@gmail.com>
Thu, 28 Apr 2016 08:03:08 +0000 (16:03 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Thu, 28 Apr 2016 08:03:08 +0000 (16:03 +0800)
youtube_dl/extractor/mwave.py

index 6485c69286d61f9ca7e2e6ea4503b0587c98b2e8..a103e0323a6c62e4b0d283afdb6d4f5662bb1869 100644 (file)
@@ -10,6 +10,7 @@ from ..utils import (
 
 class MwaveIE(InfoExtractor):
     _VALID_URL = r'https?://mwave\.interest\.me/mnettv/videodetail\.m\?searchVideoDetailVO\.clip_id=(?P<id>[0-9]+)'
+    _URL_TEMPLATE = 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=%s'
     _TEST = {
         'url': 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=168859',
         # md5 is unstable
@@ -59,7 +60,7 @@ class MwaveIE(InfoExtractor):
 
 
 class MwaveMeetGreetIE(InfoExtractor):
-    _VALID_URL = r'https?://mwave\.interest\.me/meetgreet/view/(?P<id>[0-9]+)'
+    _VALID_URL = r'https?://mwave\.interest\.me/meetgreet/view/(?P<id>\d+)'
     _TEST = {
         'url': 'http://mwave.interest.me/meetgreet/view/256',
         'info_dict': {
@@ -76,6 +77,8 @@ class MwaveMeetGreetIE(InfoExtractor):
     def _real_extract(self, url):
         video_id = self._match_id(url)
         webpage = self._download_webpage(url, video_id)
-        clip_id = self._html_search_regex(r'<iframe src="/mnettv/ifr_clip\.m\?searchVideoDetailVO\.clip_id=(?P<id>[0-9]+)', webpage, 'clip ID')
-        clip_url = 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id={0}'.format(clip_id)
+        clip_id = self._html_search_regex(
+            r'<iframe[^>]+src="/mnettv/ifr_clip\.m\?searchVideoDetailVO\.clip_id=(\d+)',
+            webpage, 'clip ID')
+        clip_url = MwaveIE._URL_TEMPLATE % clip_id
         return self.url_result(clip_url, 'Mwave', clip_id)