mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 12:49:02 +01:00
[charlierose] Simplify and improve
This commit is contained in:
parent
d13bfc07b7
commit
526656726b
@ -6,20 +6,25 @@ from ..utils import remove_end
|
|||||||
|
|
||||||
class CharlieRoseIE(InfoExtractor):
|
class CharlieRoseIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?charlierose\.com/video(?:s|/player)/(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?charlierose\.com/video(?:s|/player)/(?P<id>\d+)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'https://charlierose.com/videos/27996',
|
'url': 'https://charlierose.com/videos/27996',
|
||||||
|
'md5': 'fda41d49e67d4ce7c2411fd2c4702e09',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '27996',
|
'id': '27996',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Remembering Zaha Hadid',
|
'title': 'Remembering Zaha Hadid',
|
||||||
'thumbnail': 're:^https?://.*\.jpg\?\d+',
|
'thumbnail': 're:^https?://.*\.jpg\?\d+',
|
||||||
'description': 'We revisit past conversations with Zaha Hadid, in memory of the world renowned Iraqi architect.',
|
'description': 'We revisit past conversations with Zaha Hadid, in memory of the world renowned Iraqi architect.',
|
||||||
|
'subtitles': {
|
||||||
|
'en': [{
|
||||||
|
'ext': 'vtt',
|
||||||
|
}],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'params': {
|
}, {
|
||||||
# m3u8 download
|
'url': 'https://charlierose.com/videos/27996',
|
||||||
'skip_download': True,
|
'only_matching': True,
|
||||||
}
|
}]
|
||||||
}
|
|
||||||
|
|
||||||
_PLAYER_BASE = 'https://charlierose.com/video/player/%s'
|
_PLAYER_BASE = 'https://charlierose.com/video/player/%s'
|
||||||
|
|
||||||
@ -29,17 +34,17 @@ class CharlieRoseIE(InfoExtractor):
|
|||||||
|
|
||||||
title = remove_end(self._og_search_title(webpage), ' - Charlie Rose')
|
title = remove_end(self._og_search_title(webpage), ' - Charlie Rose')
|
||||||
|
|
||||||
entries = self._parse_html5_media_entries(self._PLAYER_BASE % video_id, webpage, video_id)[0]
|
info_dict = self._parse_html5_media_entries(
|
||||||
formats = entries['formats']
|
self._PLAYER_BASE % video_id, webpage, video_id)[0]
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(info_dict['formats'])
|
||||||
self._remove_duplicate_formats(formats)
|
self._remove_duplicate_formats(info_dict['formats'])
|
||||||
|
|
||||||
return {
|
info_dict.update({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'formats': formats,
|
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
'subtitles': entries.get('subtitles'),
|
})
|
||||||
}
|
|
||||||
|
return info_dict
|
||||||
|
Loading…
Reference in New Issue
Block a user