Compare commits

...

15 Commits

Author SHA1 Message Date
Alessandro Campolo
05285d1bf5
Merge 50b4b87a3d into be3579aaf0 2024-11-07 17:29:54 +08:00
sepro
50b4b87a3d
Oops
Co-authored-by: Mozi <29089388+pzhlkj6612@users.noreply.github.com>
2024-11-02 08:32:23 +01:00
sepro
915da295cb Merge branch 'master' into pr/5607 2024-11-02 08:26:00 +01:00
sepro
e26e4e0113 Extract m3u8 subs 2024-11-02 08:25:27 +01:00
sepro
2e4fa64c83 Slight refactor 2024-11-02 08:23:25 +01:00
Mozi
9f278cd4e2 support playlist; simplify and inline the _search_json_ld call
Co-Authored-By: sepro <sepro@sepr0.com>
2024-11-02 08:22:59 +01:00
Mozi
6311170b6a
[ie/RadioRadicale] Merge subtitles; clean code 2024-10-24 12:01:48 -05:00
bashonly
052534bcc2
Merge branch 'master' into radioradicale 2024-10-24 17:00:04 +00:00
pukkandan
393872b610
Apply suggestions from code review 2022-12-29 12:31:05 +05:30
alessandro
b757eef6c6 Corrected wrong indentation 2022-11-27 13:43:32 +01:00
alessandro
9449f0247c Added subtitles extraction 2022-11-27 13:35:58 +01:00
alessandro
8cff879101 Applied patch by @nixxo to clean up code 2022-11-27 13:09:04 +01:00
alessandro
e69db784d5 Added more metadata to extractor 2022-11-25 16:38:08 +01:00
alessandro
c5a426d844 Changed information extractor 2022-11-25 16:04:46 +01:00
alessandro
a0777c9658 [radioradicale] Add extractor 2022-11-21 00:02:36 +01:00
2 changed files with 106 additions and 0 deletions

View File

@ -1648,6 +1648,7 @@ from .radiokapital import (
RadioKapitalIE,
RadioKapitalShowIE,
)
from .radioradicale import RadioRadicaleIE
from .radiozet import RadioZetPodcastIE
from .radlive import (
RadLiveChannelIE,

View File

@ -0,0 +1,105 @@
from .common import InfoExtractor
from ..utils import url_or_none
from ..utils.traversal import traverse_obj
class RadioRadicaleIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?radioradicale\.it/scheda/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://www.radioradicale.it/scheda/471591',
'md5': 'eb0fbe43a601f1a361cbd00f3c45af4a',
'info_dict': {
'id': '471591',
'ext': 'mp4',
'title': 'md5:e8fbb8de57011a3255db0beca69af73d',
'description': 'md5:5e15a789a2fe4d67da8d1366996e89ef',
'location': 'Napoli',
'duration': 2852.0,
'timestamp': 1459987200,
'upload_date': '20160407',
'thumbnail': 'https://www.radioradicale.it/photo400/0/0/9/0/1/00901768.jpg',
},
}, {
'url': 'https://www.radioradicale.it/scheda/742783/parlamento-riunito-in-seduta-comune-11a-della-xix-legislatura',
'info_dict': {
'id': '742783',
'title': 'Parlamento riunito in seduta comune (11ª della XIX legislatura)',
'description': '-) Votazione per l\'elezione di un giudice della Corte Costituzionale (nono scrutinio)',
'location': 'CAMERA',
'duration': 5868.0,
'timestamp': 1730246400,
'upload_date': '20241030',
},
'playlist': [{
'md5': 'aa48de55dcc45478e4cd200f299aab7d',
'info_dict': {
'id': '742783-0',
'ext': 'mp4',
'title': 'Parlamento riunito in seduta comune (11ª della XIX legislatura)',
},
}, {
'md5': 'be915c189c70ad2920e5810f32260ff5',
'info_dict': {
'id': '742783-1',
'ext': 'mp4',
'title': 'Parlamento riunito in seduta comune (11ª della XIX legislatura)',
},
}, {
'md5': 'f0ee4047342baf8ed3128a8417ac5e0a',
'info_dict': {
'id': '742783-2',
'ext': 'mp4',
'title': 'Parlamento riunito in seduta comune (11ª della XIX legislatura)',
},
}],
}]
def _entries(self, videos_info, page_id):
for idx, video in enumerate(traverse_obj(
videos_info, ('playlist', lambda _, v: v['sources']))):
video_id = f'{page_id}-{idx}'
formats = []
subtitles = {}
for m3u8_url in traverse_obj(video, ('sources', ..., 'src', {url_or_none})):
fmts, subs = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
for sub in traverse_obj(video, ('subtitles', ..., lambda _, v: url_or_none(v['src']))):
self._merge_subtitles({sub.get('srclang') or 'und': [{
'url': sub['src'],
'name': sub.get('label'),
}]}, target=subtitles)
yield {
'id': video_id,
'title': video.get('title'),
'formats': formats,
'subtitles': subtitles,
}
def _real_extract(self, url):
page_id = self._match_id(url)
webpage = self._download_webpage(url, page_id)
videos_info = self._search_json(
r'jQuery\.extend\(Drupal\.settings\s*,',
webpage, 'videos_info', page_id)['RRscheda']
entries = list(self._entries(videos_info, page_id))
common_info = {
'id': page_id,
'title': self._og_search_title(webpage),
'description': self._og_search_description(webpage),
'location': videos_info.get('luogo'),
**self._search_json_ld(webpage, page_id),
}
if len(entries) == 1:
return {
**entries[0],
**common_info,
}
return self.playlist_result(entries, multi_video=True, **common_info)