diff --git a/yt_dlp/extractor/europa.py b/yt_dlp/extractor/europa.py index 35d7a085c..d39a0c615 100644 --- a/yt_dlp/extractor/europa.py +++ b/yt_dlp/extractor/europa.py @@ -1,5 +1,6 @@ from .common import InfoExtractor from ..utils import ( + int_or_none, parse_iso8601, str_or_none, traverse_obj, @@ -97,64 +98,103 @@ def _real_extract(self, url): class EuroParlWebstreamIE(InfoExtractor): _VALID_URL = r'''(?x) https?://multimedia\.europarl\.europa\.eu/ - (?:\w+/)?webstreaming/(?:[\w-]+_)?(?P[\w-]+) + (?:[^/]*/)?webstreaming/(?:[^_]*_)?(?P[\w-]+) ''' _TESTS = [{ 'url': 'https://multimedia.europarl.europa.eu/pl/webstreaming/plenary-session_20220914-0900-PLENARY', + 'md5': '16420ad9c602663759538ac1ca16a8db', 'info_dict': { - 'id': '62388b15-d85b-4add-99aa-ba12ccf64f0d', - 'display_id': '20220914-0900-PLENARY', + 'id': '20220914-0900-PLENARY', 'ext': 'mp4', 'title': 'Plenary session', + 'description': '', + 'duration': 45147, + 'thumbnail': 'https://storage.eup.glcloud.eu/thumbnail/default_thumbnail.png', 'release_timestamp': 1663139069, 'release_date': '20220914', - }, - 'params': { - 'skip_download': True, + 'modified_timestamp': 1663650921, + 'modified_date': '20220920', + 'live_status': 'was_live', }, }, { - # live webstream 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/euroscola_20221115-1000-SPECIAL-EUROSCOLA', + 'md5': '8b4304f9e15a6e133100248fb55a5dce', 'info_dict': { 'ext': 'mp4', - 'id': '510eda7f-ba72-161b-7ee7-0e836cd2e715', - 'release_timestamp': 1668502800, - 'title': 'Euroscola 2022-11-15 19:21', + 'id': '20221115-1000-SPECIAL-EUROSCOLA', + 'release_timestamp': 1668502798, + 'title': 'Euroscola', 'release_date': '20221115', - 'live_status': 'is_live', + 'live_status': 'was_live', + 'description': '', + 'duration': 9587, + 'thumbnail': 'https://storage.eup.glcloud.eu/thumbnail/default_thumbnail.png', + 'modified_timestamp': 1668945274, + 'modified_date': '20221120', }, - 'skip': 'not live anymore', }, { 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/committee-on-culture-and-education_20230301-1130-COMMITTEE-CULT', + 'md5': '0ca01cf33009d866e6f5e1cd3088c10c', 'info_dict': { - 'id': '7355662c-8eac-445e-4bb9-08db14b0ddd7', - 'display_id': '20230301-1130-COMMITTEE-CULT', + 'id': '20230301-1130-COMMITTEE-CULT', 'ext': 'mp4', 'release_date': '20230301', 'title': 'Committee on Culture and Education', 'release_timestamp': 1677666641, + 'description': 'Committee on Culture and Education', + 'duration': 1003, + 'thumbnail': 'https://storage.eup.glcloud.eu/thumbnail/default_thumbnail.png', + 'modified_timestamp': 1732475771, + 'modified_date': '20241124', + 'live_status': 'was_live', }, }, { - # live stream 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/committee-on-environment-public-health-and-food-safety_20230524-0900-COMMITTEE-ENVI', + 'md5': 'f2e8c30935f956a7165c2f4f4b4ee090', 'info_dict': { - 'id': 'e4255f56-10aa-4b3c-6530-08db56d5b0d9', + 'id': '20230524-0900-COMMITTEE-ENVI', 'ext': 'mp4', 'release_date': '20230524', - 'title': r're:Committee on Environment, Public Health and Food Safety \d{4}-\d{2}-\d{2}\s\d{2}:\d{2}', - 'release_timestamp': 1684911541, - 'live_status': 'is_live', + 'title': 'Committee on Environment, Public Health and Food Safety', + 'release_timestamp': 1684912288, + 'live_status': 'was_live', + 'description': 'Committee on Environment, Public Health and Food Safety', + 'duration': 4831, + 'thumbnail': 'https://storage.eup.glcloud.eu/thumbnail/default_thumbnail.png', + 'modified_timestamp': 1732475771, + 'modified_date': '20241124', }, - 'skip': 'Not live anymore', }, { 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/20240320-1345-SPECIAL-PRESSER', + 'md5': '518758eb706471c4c4ef3a134034a5bd', 'info_dict': { - 'id': 'c1f11567-5b52-470a-f3e1-08dc3c216ace', - 'display_id': '20240320-1345-SPECIAL-PRESSER', + 'id': '20240320-1345-SPECIAL-PRESSER', 'ext': 'mp4', 'release_date': '20240320', 'title': 'md5:7c6c814cac55dea5e2d87bf8d3db2234', 'release_timestamp': 1710939767, + 'description': 'md5:7c6c814cac55dea5e2d87bf8d3db2234', + 'duration': 927, + 'thumbnail': 'https://storage.eup.glcloud.eu/thumbnail/default_thumbnail.png', + 'modified_timestamp': 1732475771, + 'modified_date': '20241124', + 'live_status': 'was_live', + }, + }, { + 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/20250328-1600-SPECIAL-PRESSER', + 'md5': 'dd1c5e67eb55e609998583d7c2966105', + 'info_dict': { + 'id': '20250328-1600-SPECIAL-PRESSER', + 'ext': 'mp4', + 'title': 'md5:04a2ab70c183dabe891a7cd190c3121d', + 'description': '', + 'duration': 1023, + 'thumbnail': 'https://storage.eup.glcloud.eu/thumbnail/default_thumbnail.png', + 'release_timestamp': 1743177199, + 'release_date': '20250328', + 'modified_timestamp': 1743180924, + 'modified_date': '20250328', + 'live_status': 'was_live', }, }, { 'url': 'https://multimedia.europarl.europa.eu/webstreaming/briefing-for-media-on-2024-european-elections_20240429-1000-SPECIAL-OTHER', @@ -163,42 +203,40 @@ class EuroParlWebstreamIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) - stream_info = self._search_nextjs_data(webpage, video_id)['props']['pageProps'] - status = traverse_obj(stream_info, ('media_item', 'mediaSubType')) - base = 'https://control.eup.glcloud.eu/content-manager/api/v1/socket.io/?EIO=4&transport=polling' - headers = {'referer': f'https://control.eup.glcloud.eu/content-manager/content-page/{video_id}'} - sid = self._download_socket_json(base, video_id, note='Opening socket', headers=headers)['sid'] - base += '&sid=' + sid - self._download_webpage(base, video_id, 'Polling socket with payload', data=b'40/content,', headers=headers) - self._download_webpage(base, video_id, 'Polling socket', headers=headers) - self._download_socket_json(base, video_id, 'Getting broadcast metadata from socket', headers=headers) + webpage = self._download_webpage(f'https://control.eup.glcloud.eu/content-manager/content-page/{video_id}', video_id) + stream_info = self._search_json(r'