]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/bloomberg.py
3 from .common
import InfoExtractor
6 class BloombergIE(InfoExtractor
):
7 _VALID_URL
= r
'https?://(?:www\.)?bloomberg\.com/(?:[^/]+/)*(?P<id>[^/?#]+)'
10 'url': 'http://www.bloomberg.com/news/videos/b/aaeae121-5949-481e-a1ce-4562db6f5df2',
11 # The md5 checksum changes
13 'id': 'qurhIVlJSB6hzkVi229d8g',
15 'title': 'Shah\'s Presentation on Foreign-Exchange Strategies',
16 'description': 'md5:a8ba0302912d03d246979735c17d2761',
19 'format': 'best[format_id^=hds]',
22 # video ID in BPlayer(...)
23 'url': 'http://www.bloomberg.com/features/2016-hello-world-new-zealand/',
25 'id': '938c7e72-3f25-4ddb-8b85-a9be731baa74',
27 'title': 'Meet the Real-Life Tech Wizards of Middle Earth',
28 'description': 'Hello World, Episode 1: New Zealand’s freaky AI babies, robot exoskeletons, and a virtual you.',
31 'format': 'best[format_id^=hds]',
35 'url': 'https://www.bloomberg.com/politics/articles/2017-02-08/le-pen-aide-briefed-french-central-banker-on-plan-to-print-money',
36 'only_matching': True,
38 'url': 'http://www.bloomberg.com/news/articles/2015-11-12/five-strange-things-that-have-been-happening-in-financial-markets',
39 'only_matching': True,
41 'url': 'http://www.bloomberg.com/politics/videos/2015-11-25/karl-rove-on-jeb-bush-s-struggles-stopping-trump',
42 'only_matching': True,
45 def _real_extract(self
, url
):
46 name
= self
._match
_id
(url
)
47 webpage
= self
._download
_webpage
(url
, name
)
48 video_id
= self
._search
_regex
(
49 (r
'["\']bmmrId
["\']\s*:\s*(["\'])(?P
<id>(?
:(?
!\
1).)+)\
1',
50 r'videoId\s
*:\s
*(["\'])(?P<id>(?:(?!\1).)+)\1',
51 r'data-bmmrid=(["\'])(?P
<id>(?
:(?
!\
1).)+)\
1'),
52 webpage, 'id', group='id', default=None)
54 bplayer_data = self._parse_json(self._search_regex(
55 r'BPlayer\
(null
,\s
*({[^;]+}
)\
);', webpage, 'id'), name)
56 video_id = bplayer_data['id']
57 title = re.sub(': Video$
', '', self._og_search_title(webpage))
59 embed_info = self._download_json(
60 'http
://www
.bloomberg
.com
/api
/embed?
id=%s' % video_id, video_id)
62 for stream in embed_info['streams
']:
63 stream_url = stream.get('url
')
66 if stream['muxing_format
'] == 'TS
':
67 formats.extend(self._extract_m3u8_formats(
68 stream_url, video_id, 'mp4
', m3u8_id='hls
', fatal=False))
70 formats.extend(self._extract_f4m_formats(
71 stream_url, video_id, f4m_id='hds
', fatal=False))
72 self._sort_formats(formats)
78 'description
': self._og_search_description(webpage),
79 'thumbnail
': self._og_search_thumbnail(webpage),