]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/europa.py
1 from .common
import InfoExtractor
14 class EuropaIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://ec\.europa\.eu/avservices/(?:video/player|audio/audioDetails)\.cfm\?.*?\bref=(?P<id>[A-Za-z0-9-]+)'
17 'url': 'http://ec.europa.eu/avservices/video/player.cfm?ref=I107758',
18 'md5': '574f080699ddd1e19a675b0ddf010371',
22 'title': 'TRADE - Wikileaks on TTIP',
23 'description': 'NEW LIVE EC Midday press briefing of 11/08/2015',
24 'thumbnail': r
're:^https?://.*\.jpg$',
25 'upload_date': '20150811',
28 'formats': 'mincount:3',
31 'url': 'http://ec.europa.eu/avservices/video/player.cfm?sitelang=en&ref=I107786',
32 'only_matching': True,
34 'url': 'http://ec.europa.eu/avservices/audio/audioDetails.cfm?ref=I-109295&sitelang=en',
35 'only_matching': True,
38 def _real_extract(self
, url
):
39 video_id
= self
._match
_id
(url
)
41 playlist
= self
._download
_xml
(
42 'http://ec.europa.eu/avservices/video/player/playlist.cfm?ID=%s' % video_id
, video_id
)
44 def get_item(type_
, preference
):
46 for item
in playlist
.findall('./info/%s/item' % type_
):
47 lang
, label
= xpath_text(item
, 'lg', default
=None), xpath_text(item
, 'label', default
=None)
49 items
[lang
] = label
.strip()
55 preferred_lang
= query
.get('sitelang', ('en', ))[0]
57 preferred_langs
= orderedSet((preferred_lang
, 'en', 'int'))
59 title
= get_item('title', preferred_langs
) or video_id
60 description
= get_item('description', preferred_langs
)
61 thumbnail
= xpath_text(playlist
, './info/thumburl', 'thumbnail')
62 upload_date
= unified_strdate(xpath_text(playlist
, './info/date', 'upload date'))
63 duration
= parse_duration(xpath_text(playlist
, './info/duration', 'duration'))
64 view_count
= int_or_none(xpath_text(playlist
, './info/views', 'views'))
66 language_preference
= qualities(preferred_langs
[::-1])
69 for file_
in playlist
.findall('./files/file'):
70 video_url
= xpath_text(file_
, './url')
73 lang
= xpath_text(file_
, './lg')
77 'format_note': xpath_text(file_
, './lglabel'),
78 'language_preference': language_preference(lang
)
84 'description': description
,
85 'thumbnail': thumbnail
,
86 'upload_date': upload_date
,
88 'view_count': view_count
,
93 class EuroParlWebstreamIE(InfoExtractor
):
95 https?://(?:multimedia|webstreaming)\.europarl\.europa\.eu/[^/#?]+/
96 (?:embed/embed\.html\?event=|(?!video)[^/#?]+/[\w-]+_)(?P<id>[\w-]+)
99 'url': 'https://multimedia.europarl.europa.eu/pl/webstreaming/plenary-session_20220914-0900-PLENARY',
101 'id': 'bcaa1db4-76ef-7e06-8da7-839bd0ad1dbe',
103 'release_timestamp': 1663137900,
104 'title': 'Plenary session',
105 'release_date': '20220914',
108 'skip_download': True,
111 'url': 'https://multimedia.europarl.europa.eu/pl/webstreaming/eu-cop27-un-climate-change-conference-in-sharm-el-sheikh-egypt-ep-delegation-meets-with-ngo-represen_20221114-1600-SPECIAL-OTHER',
113 'id': 'a8428de8-b9cd-6a2e-11e4-3805d9c9ff5c',
115 'release_timestamp': 1668434400,
116 'release_date': '20221114',
117 'title': 'md5:d3550280c33cc70e0678652e3d52c028',
120 'skip_download': True,
124 'url': 'https://webstreaming.europarl.europa.eu/ep/embed/embed.html?event=20220914-0900-PLENARY&language=en&autoplay=true&logo=true',
126 'id': 'bcaa1db4-76ef-7e06-8da7-839bd0ad1dbe',
128 'title': 'Plenary session',
129 'release_date': '20220914',
130 'release_timestamp': 1663137900,
133 'skip_download': True,
137 'url': 'https://multimedia.europarl.europa.eu/en/webstreaming/euroscola_20221115-1000-SPECIAL-EUROSCOLA',
140 'id': '510eda7f-ba72-161b-7ee7-0e836cd2e715',
141 'release_timestamp': 1668502800,
142 'title': 'Euroscola 2022-11-15 19:21',
143 'release_date': '20221115',
144 'live_status': 'is_live',
146 'skip': 'not live anymore'
149 def _real_extract(self
, url
):
150 display_id
= self
._match
_id
(url
)
152 json_info
= self
._download
_json
(
153 'https://vis-api.vuplay.co.uk/event/external', display_id
,
155 'player_key': 'europarl|718f822c-a48c-4841-9947-c9cb9bb1743c',
156 'external_id': display_id
,
159 formats
, subtitles
= self
._extract
_mpd
_formats
_and
_subtitles
(json_info
['streaming_url'], display_id
)
160 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(
161 json_info
['streaming_url'].replace('.mpd', '.m3u8'), display_id
)
164 self
._merge
_subtitles
(subs
, target
=subtitles
)
167 'id': json_info
['id'],
168 'title': json_info
.get('title'),
170 'subtitles': subtitles
,
171 'release_timestamp': parse_iso8601(json_info
.get('published_start')),
172 'is_live': 'LIVE' in json_info
.get('state', '')