aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/escapist.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-05-04 19:04:49 +0600
committerSergey M․ <dstftw@gmail.com>2015-05-04 19:04:49 +0600
commit782e0568ef28ebd7d7a11273d0a5af065575379a (patch)
treebae2c6cf8fd5b8e7edcee6c421b6d423ab8ce141 /youtube_dl/extractor/escapist.py
parent90b4b0eabeabbdad3bfece8254692d34a3dcba95 (diff)
[escapist] Modernize
Diffstat (limited to 'youtube_dl/extractor/escapist.py')
-rw-r--r--youtube_dl/extractor/escapist.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/youtube_dl/extractor/escapist.py b/youtube_dl/extractor/escapist.py
index dadfaa6a5..2cd3af142 100644
--- a/youtube_dl/extractor/escapist.py
+++ b/youtube_dl/extractor/escapist.py
@@ -9,6 +9,7 @@ from ..utils import (
determine_ext,
clean_html,
int_or_none,
+ float_or_none,
)
@@ -65,12 +66,12 @@ class EscapistIE(InfoExtractor):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
- imsVideo = self._parse_json(
+ ims_video = self._parse_json(
self._search_regex(
r'imsVideo\.play\(({.+?})\);', webpage, 'imsVideo'),
video_id)
- video_id = imsVideo['videoID']
- key = imsVideo['hash']
+ video_id = ims_video['videoID']
+ key = ims_video['hash']
config_req = compat_urllib_request.Request(
'http://www.escapistmagazine.com/videos/'
@@ -80,8 +81,11 @@ class EscapistIE(InfoExtractor):
data = json.loads(_decrypt_config(key, config))
- title = clean_html(data['videoData']['title'])
- duration = data['videoData']['duration'] / 1000
+ video_data = data['videoData']
+
+ title = clean_html(video_data['title'])
+ duration = float_or_none(video_data.get('duration'), 1000)
+ uploader = video_data.get('publisher')
formats = [{
'url': video['src'],
@@ -97,4 +101,5 @@ class EscapistIE(InfoExtractor):
'thumbnail': self._og_search_thumbnail(webpage),
'description': self._og_search_description(webpage),
'duration': duration,
+ 'uploader': uploader,
}