1 from .common
import InfoExtractor
15 class EuropaIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://ec\.europa\.eu/avservices/(?:video/player|audio/audioDetails)\.cfm\?.*?\bref=(?P<id>[A-Za-z0-9-]+)'
19 'url': 'http://ec.europa.eu/avservices/video/player.cfm?ref=I107758',
20 'md5': '574f080699ddd1e19a675b0ddf010371',
24 'title': 'TRADE - Wikileaks on TTIP',
25 'description': 'NEW LIVE EC Midday press briefing of 11/08/2015',
26 'thumbnail': r
're:^https?://.*\.jpg$',
27 'upload_date': '20150811',
30 'formats': 'mincount:3',
33 'url': 'http://ec.europa.eu/avservices/video/player.cfm?sitelang=en&ref=I107786',
34 'only_matching': True,
36 'url': 'http://ec.europa.eu/avservices/audio/audioDetails.cfm?ref=I-109295&sitelang=en',
37 'only_matching': True,
40 def _real_extract(self
, url
):
41 video_id
= self
._match
_id
(url
)
43 playlist
= self
._download
_xml
(
44 f
'http://ec.europa.eu/avservices/video/player/playlist.cfm?ID={video_id}', video_id
)
46 def get_item(type_
, preference
):
48 for item
in playlist
.findall(f
'./info/{type_}/item'):
49 lang
, label
= xpath_text(item
, 'lg', default
=None), xpath_text(item
, 'label', default
=None)
51 items
[lang
] = label
.strip()
57 preferred_lang
= query
.get('sitelang', ('en', ))[0]
59 preferred_langs
= orderedSet((preferred_lang
, 'en', 'int'))
61 title
= get_item('title', preferred_langs
) or video_id
62 description
= get_item('description', preferred_langs
)
63 thumbnail
= xpath_text(playlist
, './info/thumburl', 'thumbnail')
64 upload_date
= unified_strdate(xpath_text(playlist
, './info/date', 'upload date'))
65 duration
= parse_duration(xpath_text(playlist
, './info/duration', 'duration'))
66 view_count
= int_or_none(xpath_text(playlist
, './info/views', 'views'))
68 language_preference
= qualities(preferred_langs
[::-1])
71 for file_
in playlist
.findall('./files/file'):
72 video_url
= xpath_text(file_
, './url')
75 lang
= xpath_text(file_
, './lg')
79 'format_note': xpath_text(file_
, './lglabel'),
80 'language_preference': language_preference(lang
),
86 'description': description
,
87 'thumbnail': thumbnail
,
88 'upload_date': upload_date
,
90 'view_count': view_count
,
95 class EuroParlWebstreamIE(InfoExtractor
):
97 https?://multimedia\.europarl\.europa\.eu/
98 (?:\w+/)?webstreaming/(?:[\w-]+_)?(?P<id>[\w-]+)
101 'url': 'https://multimedia.europarl.europa.eu/pl/webstreaming/plenary-session_20220914-0900-PLENARY',
103 'id': '62388b15-d85b-4add-99aa-ba12ccf64f0d',
104 'display_id': '20220914-0900-PLENARY',
106 'title': 'Plenary session',
107 'release_timestamp': 1663139069,
108 'release_date': '20220914',
111 'skip_download': True,
115 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/euroscola_20221115-1000-SPECIAL-EUROSCOLA',
118 'id': '510eda7f-ba72-161b-7ee7-0e836cd2e715',
119 'release_timestamp': 1668502800,
120 'title': 'Euroscola 2022-11-15 19:21',
121 'release_date': '20221115',
122 'live_status': 'is_live',
124 'skip': 'not live anymore',
126 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/committee-on-culture-and-education_20230301-1130-COMMITTEE-CULT',
128 'id': '7355662c-8eac-445e-4bb9-08db14b0ddd7',
129 'display_id': '20230301-1130-COMMITTEE-CULT',
131 'release_date': '20230301',
132 'title': 'Committee on Culture and Education',
133 'release_timestamp': 1677666641,
137 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/committee-on-environment-public-health-and-food-safety_20230524-0900-COMMITTEE-ENVI',
139 'id': 'e4255f56-10aa-4b3c-6530-08db56d5b0d9',
141 'release_date': '20230524',
142 'title': r
're:Committee on Environment, Public Health and Food Safety \d{4}-\d{2}-\d{2}\s\d{2}:\d{2}',
143 'release_timestamp': 1684911541,
144 'live_status': 'is_live',
146 'skip': 'Not live anymore',
148 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/20240320-1345-SPECIAL-PRESSER',
150 'id': 'c1f11567-5b52-470a-f3e1-08dc3c216ace',
151 'display_id': '20240320-1345-SPECIAL-PRESSER',
153 'release_date': '20240320',
154 'title': 'md5:7c6c814cac55dea5e2d87bf8d3db2234',
155 'release_timestamp': 1710939767,
158 'url': 'https://multimedia.europarl.europa.eu/webstreaming/briefing-for-media-on-2024-european-elections_20240429-1000-SPECIAL-OTHER',
159 'only_matching': True,
162 def _real_extract(self
, url
):
163 display_id
= self
._match
_id
(url
)
164 webpage
= self
._download
_webpage
(url
, display_id
)
166 webpage_nextjs
= self
._search
_nextjs
_data
(webpage
, display_id
)['props']['pageProps']
168 json_info
= self
._download
_json
(
169 'https://acs-api.europarl.connectedviews.eu/api/FullMeeting', display_id
,
172 'tenantId': 'bae646ca-1fc8-4363-80ba-2c04f06b4968',
173 'externalReference': display_id
,
176 formats
, subtitles
= [], {}
177 for hls_url
in traverse_obj(json_info
, ((('meetingVideo'), ('meetingVideos', ...)), 'hlsUrl')):
178 fmt
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(hls_url
, display_id
)
180 self
._merge
_subtitles
(subs
, target
=subtitles
)
183 'id': json_info
['id'],
184 'display_id': display_id
,
185 'title': traverse_obj(webpage_nextjs
, (('mediaItem', 'title'), ('title', )), get_all
=False),
187 'subtitles': subtitles
,
188 'release_timestamp': parse_iso8601(json_info
.get('startDateTime')),
189 'is_live': traverse_obj(webpage_nextjs
, ('mediaItem', 'mediaSubType')) == 'Live',