3 from .common
import InfoExtractor
6 class BloombergIE(InfoExtractor
):
7 _VALID_URL
= r
'https?://(?:www\.)?bloomberg\.com/(?:[^/]+/)*(?P<id>[^/?#]+)'
10 'url': 'https://www.bloomberg.com/news/videos/2021-09-14/apple-unveils-the-new-iphone-13-stock-doesn-t-move-much-video',
12 'id': 'V8cFcYMxTHaMcEiiYVr39A',
14 'title': 'Apple Unveils the New IPhone 13, Stock Doesn\'t Move Much',
17 'format': 'best[format_id^=hds]',
20 # video ID in BPlayer(...)
21 'url': 'http://www.bloomberg.com/features/2016-hello-world-new-zealand/',
23 'id': '938c7e72-3f25-4ddb-8b85-a9be731baa74',
25 'title': 'Meet the Real-Life Tech Wizards of Middle Earth',
26 'description': 'Hello World, Episode 1: New Zealand’s freaky AI babies, robot exoskeletons, and a virtual you.',
29 'format': 'best[format_id^=hds]',
33 'url': 'https://www.bloomberg.com/politics/articles/2017-02-08/le-pen-aide-briefed-french-central-banker-on-plan-to-print-money',
34 'only_matching': True,
36 'url': 'http://www.bloomberg.com/news/articles/2015-11-12/five-strange-things-that-have-been-happening-in-financial-markets',
37 'only_matching': True,
39 'url': 'http://www.bloomberg.com/politics/videos/2015-11-25/karl-rove-on-jeb-bush-s-struggles-stopping-trump',
40 'only_matching': True,
43 def _real_extract(self
, url
):
44 name
= self
._match
_id
(url
)
45 webpage
= self
._download
_webpage
(url
, name
)
46 video_id
= self
._search
_regex
(
47 (r
'["\']bmmrId
["\']\s*:\s*(["\'])(?P
<id>(?
:(?
!\
1).)+)\
1',
48 r'videoId\s
*:\s
*(["\'])(?P<id>(?:(?!\1).)+)\1',
49 r'data-bmmrid=(["\'])(?P
<id>(?
:(?
!\
1).)+)\
1'),
50 webpage, 'id', group='id', default=None)
52 bplayer_data = self._parse_json(self._search_regex(
53 r'BPlayer\
(null
,\s
*({[^
;]+})\
);', webpage, 'id'), name)
54 video_id = bplayer_data['id']
55 title = re.sub(': Video$
', '', self._og_search_title(webpage))
57 embed_info = self._download_json(
58 f'http
://www
.bloomberg
.com
/multimedia
/api
/embed?
id={video_id}
', video_id)
60 for stream in embed_info['streams
']:
61 stream_url = stream.get('url
')
64 if stream['muxing_format
'] == 'TS
':
65 formats.extend(self._extract_m3u8_formats(
66 stream_url, video_id, 'mp4
', m3u8_id='hls
', fatal=False))
68 formats.extend(self._extract_f4m_formats(
69 stream_url, video_id, f4m_id='hds
', fatal=False))
75 'description
': self._og_search_description(webpage),
76 'thumbnail
': self._og_search_thumbnail(webpage),