]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/bfmtv.py
3 from .common
import InfoExtractor
4 from ..utils
import extract_attributes
7 class BFMTVBaseIE(InfoExtractor
):
8 _VALID_URL_BASE
= r
'https?://(?:www\.)?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,
37 def _real_extract(self
, url
):
38 bfmtv_id
= self
._match
_id
(url
)
39 webpage
= self
._download
_webpage
(url
, bfmtv_id
)
40 video_block
= extract_attributes(self
._search
_regex
(
41 self
._VIDEO
_BLOCK
_REGEX
, webpage
, 'video block'))
42 return self
._brightcove
_url
_result
(video_block
['videoid'], video_block
)
45 class BFMTVLiveIE(BFMTVIE
):
46 IE_NAME
= 'bfmtv:live'
47 _VALID_URL
= BFMTVBaseIE
._VALID
_URL
_BASE
+ '(?P<id>(?:[^/]+/)?en-direct)'
49 'url': 'https://www.bfmtv.com/en-direct/',
51 'id': '5615950982001',
53 'title': r
're:^le direct BFMTV WEB \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
54 'uploader_id': '876450610001',
55 'upload_date': '20171018',
56 'timestamp': 1508329950,
59 'skip_download': True,
62 'url': 'https://www.bfmtv.com/economie/en-direct/',
63 'only_matching': True,
67 class BFMTVArticleIE(BFMTVBaseIE
):
68 IE_NAME
= 'bfmtv:article'
69 _VALID_URL
= BFMTVBaseIE
._VALID
_URL
_TMPL
% 'A'
71 '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',
74 'title': 'Covid-19: un responsable de l\'Institut Pasteur se demande "quand la France va se reconfiner"',
75 'description': 'md5:947974089c303d3ac6196670ae262843',
79 'url': 'https://www.bfmtv.com/international/pour-bolsonaro-le-bresil-est-en-faillite-mais-il-ne-peut-rien-faire_AD-202101060232.html',
80 'only_matching': True,
82 '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',
83 'only_matching': True,
86 def _real_extract(self
, url
):
87 bfmtv_id
= self
._match
_id
(url
)
88 webpage
= self
._download
_webpage
(url
, bfmtv_id
)
91 for video_block_el
in re
.findall(self
._VIDEO
_BLOCK
_REGEX
, webpage
):
92 video_block
= extract_attributes(video_block_el
)
93 video_id
= video_block
.get('videoid')
96 entries
.append(self
._brightcove
_url
_result
(video_id
, video_block
))
98 return self
.playlist_result(
99 entries
, bfmtv_id
, self
._og
_search
_title
(webpage
, fatal
=False),
100 self
._html
_search
_meta
(['og:description', 'description'], webpage
))