3 from .common
import InfoExtractor
4 from ..utils
import ExtractorError
, extract_attributes
7 class BFMTVBaseIE(InfoExtractor
):
8 _VALID_URL_BASE
= r
'https?://(?:www\.|rmc\.)?bfmtv\.com/'
9 _VALID_URL_TMPL
= _VALID_URL_BASE
+ r
'(?:[^/]+/)*[^/?&#]+_%s[A-Z]-(?P<id>\d{12})\.html'
10 _VIDEO_BLOCK_REGEX
= r
'(<div[^>]+class="video_block[^"]*"[^>]*>.*?</div>)'
11 _VIDEO_ELEMENT_REGEX
= r
'(<video-js[^>]+>)'
12 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
14 def _extract_video(self
, video_block
):
15 video_element
= self
._search
_regex
(
16 self
._VIDEO
_ELEMENT
_REGEX
, video_block
, 'video element', default
=None)
18 video_element_attrs
= extract_attributes(video_element
)
19 video_id
= video_element_attrs
.get('data-video-id')
22 account_id
= video_element_attrs
.get('data-account') or '876450610001'
23 player_id
= video_element_attrs
.get('adjustplayer') or '19dszYXgm'
25 video_block_attrs
= extract_attributes(video_block
)
26 video_id
= video_block_attrs
.get('videoid')
29 account_id
= video_block_attrs
.get('accountid') or '876630703001'
30 player_id
= video_block_attrs
.get('playerid') or 'KbPwEbuHx'
31 return self
.url_result(
32 self
.BRIGHTCOVE_URL_TEMPLATE
% (account_id
, player_id
, video_id
),
33 'BrightcoveNew', video_id
)
36 class BFMTVIE(BFMTVBaseIE
):
38 _VALID_URL
= BFMTVBaseIE
._VALID
_URL
_TMPL
% 'V'
40 'url': 'https://www.bfmtv.com/politique/emmanuel-macron-l-islam-est-une-religion-qui-vit-une-crise-aujourd-hui-partout-dans-le-monde_VN-202010020146.html',
42 'id': '6196747868001',
44 'title': 'Emmanuel Macron: "L\'Islam est une religion qui vit une crise aujourd’hui, partout dans le monde"',
45 'description': 'Le Président s\'exprime sur la question du séparatisme depuis les Mureaux, dans les Yvelines.',
46 'uploader_id': '876450610001',
47 'upload_date': '20201002',
48 'timestamp': 1601629620,
50 'tags': ['bfmactu', 'politique'],
51 'thumbnail': 'https://cf-images.eu-west-1.prod.boltdns.net/v1/static/876450610001/5041f4c1-bc48-4af8-a256-1b8300ad8ef0/cf2f9114-e8e2-4494-82b4-ab794ea4bc7d/1920x1080/match/image.jpg',
55 def _real_extract(self
, url
):
56 bfmtv_id
= self
._match
_id
(url
)
57 webpage
= self
._download
_webpage
(url
, bfmtv_id
)
58 video
= self
._extract
_video
(self
._search
_regex
(
59 self
._VIDEO
_BLOCK
_REGEX
, webpage
, 'video block'))
61 raise ExtractorError('Failed to extract video')
65 class BFMTVLiveIE(BFMTVBaseIE
):
66 IE_NAME
= 'bfmtv:live'
67 _VALID_URL
= BFMTVBaseIE
._VALID
_URL
_BASE
+ '(?P<id>(?:[^/]+/)?en-direct)'
69 'url': 'https://www.bfmtv.com/en-direct/',
71 'id': '6346069778112',
73 'title': r
're:^Le Live BFM TV \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
74 'uploader_id': '876450610001',
75 'upload_date': '20240202',
76 'timestamp': 1706887572,
77 'live_status': 'is_live',
78 'thumbnail': r
're:https://.+/image\.jpg',
82 'skip_download': True,
85 'url': 'https://www.bfmtv.com/economie/en-direct/',
86 'only_matching': True,
89 def _real_extract(self
, url
):
90 bfmtv_id
= self
._match
_id
(url
)
91 webpage
= self
._download
_webpage
(url
, bfmtv_id
)
92 video
= self
._extract
_video
(self
._search
_regex
(
93 self
._VIDEO
_BLOCK
_REGEX
, webpage
, 'video block'))
95 raise ExtractorError('Failed to extract video')
99 class BFMTVArticleIE(BFMTVBaseIE
):
100 IE_NAME
= 'bfmtv:article'
101 _VALID_URL
= BFMTVBaseIE
._VALID
_URL
_TMPL
% 'A'
103 'url': 'https://www.bfmtv.com/sante/covid-19-un-responsable-de-l-institut-pasteur-se-demande-quand-la-france-va-se-reconfiner_AV-202101060198.html',
105 'id': '202101060198',
106 'title': 'Covid-19: un responsable de l\'Institut Pasteur se demande "quand la France va se reconfiner"',
107 'description': 'md5:947974089c303d3ac6196670ae262843',
111 'url': 'https://www.bfmtv.com/international/pour-bolsonaro-le-bresil-est-en-faillite-mais-il-ne-peut-rien-faire_AD-202101060232.html',
112 'only_matching': True,
114 'url': 'https://www.bfmtv.com/sante/covid-19-oui-le-vaccin-de-pfizer-distribue-en-france-a-bien-ete-teste-sur-des-personnes-agees_AN-202101060275.html',
115 'only_matching': True,
117 'url': 'https://rmc.bfmtv.com/actualites/societe/transports/ce-n-est-plus-tout-rentable-le-bioethanol-e85-depasse-1eu-le-litre-des-automobilistes-regrettent_AV-202301100268.html',
119 'id': '6318445464112',
121 'title': 'Le plein de bioéthanol fait de plus en plus mal à la pompe',
122 'uploader_id': '876630703001',
123 'upload_date': '20230110',
124 'timestamp': 1673341692,
126 'tags': ['rmc', 'show', 'apolline de malherbe', 'info', 'talk', 'matinale', 'radio'],
127 'thumbnail': 'https://cf-images.eu-west-1.prod.boltdns.net/v1/static/876630703001/5bef74b8-9d5e-4480-a21f-60c2e2480c46/96c88b74-f9db-45e1-8040-e199c5da216c/1920x1080/match/image.jpg',
131 def _entries(self
, webpage
):
132 for video_block_el
in re
.findall(self
._VIDEO
_BLOCK
_REGEX
, webpage
):
133 video
= self
._extract
_video
(video_block_el
)
137 def _real_extract(self
, url
):
138 bfmtv_id
= self
._match
_id
(url
)
139 webpage
= self
._download
_webpage
(url
, bfmtv_id
)
141 return self
.playlist_result(
142 self
._entries
(webpage
), bfmtv_id
, self
._og
_search
_title
(webpage
, fatal
=False),
143 self
._html
_search
_meta
(['og:description', 'description'], webpage
))