]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/bfmtv.py
87f011783bfef6a75f79e05b4a86c8b1b51666f8
3 from .common
import InfoExtractor
4 from ..utils
import 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[^"]*"[^>]*>)'
11 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
13 def _brightcove_url_result(self
, video_id
, video_block
):
14 account_id
= video_block
.get('accountid') or '876450612001'
15 player_id
= video_block
.get('playerid') or 'I2qBTln4u'
16 return self
.url_result(
17 self
.BRIGHTCOVE_URL_TEMPLATE
% (account_id
, player_id
, video_id
),
18 'BrightcoveNew', video_id
)
21 class BFMTVIE(BFMTVBaseIE
):
23 _VALID_URL
= BFMTVBaseIE
._VALID
_URL
_TMPL
% 'V'
25 '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',
27 'id': '6196747868001',
29 'title': 'Emmanuel Macron: "L\'Islam est une religion qui vit une crise aujourd’hui, partout dans le monde"',
30 'description': 'Le Président s\'exprime sur la question du séparatisme depuis les Mureaux, dans les Yvelines.',
31 'uploader_id': '876450610001',
32 'upload_date': '20201002',
33 'timestamp': 1601629620,
35 'tags': ['bfmactu', 'politique'],
36 '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',
40 def _real_extract(self
, url
):
41 bfmtv_id
= self
._match
_id
(url
)
42 webpage
= self
._download
_webpage
(url
, bfmtv_id
)
43 video_block
= extract_attributes(self
._search
_regex
(
44 self
._VIDEO
_BLOCK
_REGEX
, webpage
, 'video block'))
45 return self
._brightcove
_url
_result
(video_block
['videoid'], video_block
)
48 class BFMTVLiveIE(BFMTVIE
): # XXX: Do not subclass from concrete IE
49 IE_NAME
= 'bfmtv:live'
50 _VALID_URL
= BFMTVBaseIE
._VALID
_URL
_BASE
+ '(?P<id>(?:[^/]+/)?en-direct)'
52 'url': 'https://www.bfmtv.com/en-direct/',
54 'id': '5615950982001',
56 'title': r
're:^le direct BFMTV WEB \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
57 'uploader_id': '876450610001',
58 'upload_date': '20220926',
59 'timestamp': 1664207191,
60 'live_status': 'is_live',
61 'thumbnail': r
're:https://.+/image\.jpg',
65 'skip_download': True,
68 'url': 'https://www.bfmtv.com/economie/en-direct/',
69 'only_matching': True,
73 class BFMTVArticleIE(BFMTVBaseIE
):
74 IE_NAME
= 'bfmtv:article'
75 _VALID_URL
= BFMTVBaseIE
._VALID
_URL
_TMPL
% 'A'
77 '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',
80 'title': 'Covid-19: un responsable de l\'Institut Pasteur se demande "quand la France va se reconfiner"',
81 'description': 'md5:947974089c303d3ac6196670ae262843',
85 'url': 'https://www.bfmtv.com/international/pour-bolsonaro-le-bresil-est-en-faillite-mais-il-ne-peut-rien-faire_AD-202101060232.html',
86 'only_matching': True,
88 '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',
89 'only_matching': True,
91 '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',
93 'id': '6318445464112',
95 'title': 'Le plein de bioéthanol fait de plus en plus mal à la pompe',
96 'uploader_id': '876630703001',
97 'upload_date': '20230110',
98 'timestamp': 1673341692,
100 'tags': ['rmc', 'show', 'apolline de malherbe', 'info', 'talk', 'matinale', 'radio'],
101 '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',
105 def _real_extract(self
, url
):
106 bfmtv_id
= self
._match
_id
(url
)
107 webpage
= self
._download
_webpage
(url
, bfmtv_id
)
110 for video_block_el
in re
.findall(self
._VIDEO
_BLOCK
_REGEX
, webpage
):
111 video_block
= extract_attributes(video_block_el
)
112 video_id
= video_block
.get('videoid')
115 entries
.append(self
._brightcove
_url
_result
(video_id
, video_block
))
117 return self
.playlist_result(
118 entries
, bfmtv_id
, self
._og
_search
_title
(webpage
, fatal
=False),
119 self
._html
_search
_meta
(['og:description', 'description'], webpage
))