aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2016-08-05 21:01:16 +0100
committerRemita Amine <remitamine@gmail.com>2016-08-05 21:01:16 +0100
commite563c0d73b778a1c91007f8abe0e6b43b1f7b608 (patch)
treec04b726b59bb974affbe091efe095db4ef36ee16
parent491c42e690bd51687e43fd5178bebf99dcc2cc0c (diff)
[condenast] fallback to loader.js if video.js fail
-rw-r--r--youtube_dl/extractor/condenast.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/youtube_dl/extractor/condenast.py b/youtube_dl/extractor/condenast.py
index 976a0e89d..15fabbb1c 100644
--- a/youtube_dl/extractor/condenast.py
+++ b/youtube_dl/extractor/condenast.py
@@ -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 = []