[cleanup] Make more playlist entries lazy (#11763)
[yt-dlp.git] / yt_dlp / extractor / lcp.py
blob69148be222665175a8ee343b9e5b07ba97affed8
1 from .arkena import ArkenaIE
2 from .common import InfoExtractor
5 class LcpPlayIE(ArkenaIE): # XXX: Do not subclass from concrete IE
6 _VALID_URL = r'https?://play\.lcp\.fr/embed/(?P<id>[^/]+)/(?P<account_id>[^/]+)/[^/]+/[^/]+'
7 _TESTS = [{
8 'url': 'http://play.lcp.fr/embed/327336/131064/darkmatter/0',
9 'md5': 'b8bd9298542929c06c1c15788b1f277a',
10 'info_dict': {
11 'id': '327336',
12 'ext': 'mp4',
13 'title': '327336',
14 'timestamp': 1456391602,
15 'upload_date': '20160225',
17 'params': {
18 'skip_download': True,
23 class LcpIE(InfoExtractor):
24 _VALID_URL = r'https?://(?:www\.)?lcp\.fr/(?:[^/]+/)*(?P<id>[^/]+)'
26 _TESTS = [{
27 # arkena embed
28 'url': 'http://www.lcp.fr/la-politique-en-video/schwartzenberg-prg-preconise-francois-hollande-de-participer-une-primaire',
29 'md5': 'b8bd9298542929c06c1c15788b1f277a',
30 'info_dict': {
31 'id': 'd56d03e9',
32 'ext': 'mp4',
33 'title': 'Schwartzenberg (PRG) préconise à François Hollande de participer à une primaire à gauche',
34 'description': 'md5:96ad55009548da9dea19f4120c6c16a8',
35 'timestamp': 1456488895,
36 'upload_date': '20160226',
38 'params': {
39 'skip_download': True,
41 }, {
42 # dailymotion live stream
43 'url': 'http://www.lcp.fr/le-direct',
44 'info_dict': {
45 'id': 'xji3qy',
46 'ext': 'mp4',
47 'title': 'La Chaine Parlementaire (LCP), Live TNT',
48 'description': 'md5:5c69593f2de0f38bd9a949f2c95e870b',
49 'uploader': 'LCP',
50 'uploader_id': 'xbz33d',
51 'timestamp': 1308923058,
52 'upload_date': '20110624',
54 'params': {
55 # m3u8 live stream
56 'skip_download': True,
58 }, {
59 'url': 'http://www.lcp.fr/emissions/277792-les-volontaires',
60 'only_matching': True,
63 def _real_extract(self, url):
64 display_id = self._match_id(url)
66 webpage = self._download_webpage(url, display_id)
68 play_url = self._search_regex(
69 rf'<iframe[^>]+src=(["\'])(?P<url>{LcpPlayIE._VALID_URL}?(?:(?!\1).)*)\1',
70 webpage, 'play iframe', default=None, group='url')
72 if not play_url:
73 return self.url_result(url, 'Generic')
75 title = self._og_search_title(webpage, default=None) or self._html_search_meta(
76 'twitter:title', webpage, fatal=True)
77 description = self._html_search_meta(
78 ('description', 'twitter:description'), webpage)
80 return {
81 '_type': 'url_transparent',
82 'ie_key': LcpPlayIE.ie_key(),
83 'url': play_url,
84 'display_id': display_id,
85 'title': title,
86 'description': description,