]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[condenast] fallback to loader.js if video.js fail
authorRemita Amine <remitamine@gmail.com>
Fri, 5 Aug 2016 20:01:16 +0000 (21:01 +0100)
committerRemita Amine <remitamine@gmail.com>
Fri, 5 Aug 2016 20:01:16 +0000 (21:01 +0100)
youtube_dl/extractor/condenast.py

index 976a0e89d622295ab7e3fad01933903613021104..15fabbb1c4edcdcb9451e2630dd1bc4b54fea2b1 100644 (file)
@@ -113,11 +113,19 @@ class CondeNastIE(InfoExtractor):
                 'target': params['id'],
             })
         video_id = query['videoId']
+        video_info = None
         info_page = self._download_webpage(
             'http://player.cnevids.com/player/video.js',
-            video_id, 'Downloading video info', query=query)
-        video_info = self._parse_json(self._search_regex(
-            r'loadCallback\(({.+})\)', info_page, 'video info'), video_id)['video']
+            video_id, 'Downloading video info', query=query, fatal=False)
+        if info_page:
+            video_info = self._parse_json(self._search_regex(
+                r'loadCallback\(({.+})\)', info_page, 'video info'), video_id)['video']
+        else:
+            info_page = self._download_webpage(
+                'http://player.cnevids.com/player/loader.js',
+                video_id, 'Downloading loader info', query=query)
+            video_info = self._parse_json(self._search_regex(
+                r'var\s+video\s*=\s*({.+?});', info_page, 'video info'), video_id)
         title = video_info['title']
 
         formats = []