mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 06:27:21 +00:00
[ie/RadioRadicale] Merge subtitles; clean code
This commit is contained in:
parent
052534bcc2
commit
6311170b6a
|
@ -1,8 +1,6 @@
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import url_or_none
|
||||||
strftime_or_none,
|
from ..utils.traversal import traverse_obj
|
||||||
traverse_obj,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class RadioRadicaleIE(InfoExtractor):
|
class RadioRadicaleIE(InfoExtractor):
|
||||||
|
@ -38,10 +36,12 @@ def _real_extract(self, url):
|
||||||
formats.extend(
|
formats.extend(
|
||||||
self._extract_m3u8_formats(source.get('src'), video_id))
|
self._extract_m3u8_formats(source.get('src'), video_id))
|
||||||
|
|
||||||
subtitles = {sub.get('srclang') or 'und': [{
|
subtitles = {}
|
||||||
'url': sub.get('src'),
|
for sub in traverse_obj(video_info, ('playlist', 0, 'subtitles')):
|
||||||
'name': sub.get('label')
|
self._merge_subtitles({sub.get('srclang') or 'und': [{
|
||||||
}] for sub in traverse_obj(video_info, ('playlist', 0, 'subtitles', ...))}
|
'url': sub.get('src'),
|
||||||
|
'name': sub.get('label'),
|
||||||
|
}]}, target=subtitles)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
@ -50,7 +50,6 @@ def _real_extract(self, url):
|
||||||
'title': json_ld.get('title') or self._og_search_title(webpage),
|
'title': json_ld.get('title') or self._og_search_title(webpage),
|
||||||
'location': video_info.get('luogo'),
|
'location': video_info.get('luogo'),
|
||||||
'timestamp': json_ld.get('timestamp'),
|
'timestamp': json_ld.get('timestamp'),
|
||||||
'upload_date': strftime_or_none(json_ld.get('timestamp'), '%Y%m%d'),
|
'thumbnail': traverse_obj(json_ld, ('thumbnails', 0, 'url', {url_or_none})),
|
||||||
'thumbnail': traverse_obj(json_ld, ('thumbnails', 0, 'url')),
|
|
||||||
'description': json_ld.get('description') or self._og_search_description(webpage),
|
'description': json_ld.get('description') or self._og_search_description(webpage),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue