[vlive] Add info about www. to m. redirects for mobile
[youtube-dl] / youtube_dl / extractor / vlive.py
index 6a403cc649e5071c70f8940e90a4c44b5ae08a09..a456f8217f0b72257a2a5be0d52603170e1329a3 100644 (file)
@@ -16,6 +16,7 @@ from ..compat import compat_urllib_parse
 
 class VLiveIE(InfoExtractor):
     IE_NAME = 'vlive'
+    # www.vlive.tv/video/ links redirect to m.vlive.tv/video/ for mobile devices
     _VALID_URL = r'https?://(?:(www|m)\.)?vlive\.tv/video/(?P<id>[0-9]+)'
     _TEST = {
         'url': 'http://m.vlive.tv/video/1326',
@@ -39,7 +40,7 @@ class VLiveIE(InfoExtractor):
         title = self._og_search_title(webpage)
         thumbnail = self._og_search_thumbnail(webpage)
         creator = self._html_search_regex(
-            r'<span class="name">([^<>]+)</span>', webpage, 'creator')
+            r'<span[^>]+class="name">([^<>]+)</span>', webpage, 'creator')
         
         url = 'http://global.apis.naver.com/globalV/globalV/vod/%s/playinfo?' % video_id
         msgpad = '%.0f' % (time() * 1000)
@@ -51,7 +52,7 @@ class VLiveIE(InfoExtractor):
         playinfo = self._download_json(url, video_id, 'Downloading video json')
 
         if playinfo.get('message', '') != 'success':
-            raise ExtractorError(playinfo['message'])
+            raise ExtractorError(playinfo.get('message', 'JSON request unsuccessful'))
 
         if not playinfo.get('result'):
             raise ExtractorError('No videos found.')