mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 02:25:11 +00:00
[escapist] Modernize
This commit is contained in:
parent
90b4b0eabe
commit
782e0568ef
1 changed files with 10 additions and 5 deletions
|
@ -9,6 +9,7 @@
|
||||||
determine_ext,
|
determine_ext,
|
||||||
clean_html,
|
clean_html,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
float_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,12 +66,12 @@ def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
imsVideo = self._parse_json(
|
ims_video = self._parse_json(
|
||||||
self._search_regex(
|
self._search_regex(
|
||||||
r'imsVideo\.play\(({.+?})\);', webpage, 'imsVideo'),
|
r'imsVideo\.play\(({.+?})\);', webpage, 'imsVideo'),
|
||||||
video_id)
|
video_id)
|
||||||
video_id = imsVideo['videoID']
|
video_id = ims_video['videoID']
|
||||||
key = imsVideo['hash']
|
key = ims_video['hash']
|
||||||
|
|
||||||
config_req = compat_urllib_request.Request(
|
config_req = compat_urllib_request.Request(
|
||||||
'http://www.escapistmagazine.com/videos/'
|
'http://www.escapistmagazine.com/videos/'
|
||||||
|
@ -80,8 +81,11 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
data = json.loads(_decrypt_config(key, config))
|
data = json.loads(_decrypt_config(key, config))
|
||||||
|
|
||||||
title = clean_html(data['videoData']['title'])
|
video_data = data['videoData']
|
||||||
duration = data['videoData']['duration'] / 1000
|
|
||||||
|
title = clean_html(video_data['title'])
|
||||||
|
duration = float_or_none(video_data.get('duration'), 1000)
|
||||||
|
uploader = video_data.get('publisher')
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'url': video['src'],
|
'url': video['src'],
|
||||||
|
@ -97,4 +101,5 @@ def _real_extract(self, url):
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
|
'uploader': uploader,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue