]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/bloomberg.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
8 class BloombergIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?bloomberg\.com/(?:[^/]+/)*(?P<id>[^/?#]+)'
12 'url': 'http://www.bloomberg.com/news/videos/b/aaeae121-5949-481e-a1ce-4562db6f5df2',
13 # The md5 checksum changes
15 'id': 'qurhIVlJSB6hzkVi229d8g',
17 'title': 'Shah\'s Presentation on Foreign-Exchange Strategies',
18 'description': 'md5:a8ba0302912d03d246979735c17d2761',
21 'url': 'http://www.bloomberg.com/news/articles/2015-11-12/five-strange-things-that-have-been-happening-in-financial-markets',
22 'only_matching': True,
24 'url': 'http://www.bloomberg.com/politics/videos/2015-11-25/karl-rove-on-jeb-bush-s-struggles-stopping-trump',
25 'only_matching': True,
28 def _real_extract(self
, url
):
29 name
= self
._match
_id
(url
)
30 webpage
= self
._download
_webpage
(url
, name
)
31 video_id
= self
._search
_regex
(
32 r
'["\']bmmrId
["\']\s*:\s*(["\'])(?P
<url
>.+?
)\
1',
33 webpage, 'id', group='url
')
34 title = re.sub(': Video$
', '', self._og_search_title(webpage))
36 embed_info = self._download_json(
37 'http
://www
.bloomberg
.com
/api
/embed?
id=%s' % video_id, video_id)
39 for stream in embed_info['streams
']:
40 stream_url = stream.get('url
')
43 if stream['muxing_format
'] == 'TS
':
44 formats.extend(self._extract_m3u8_formats(
45 stream_url, video_id, 'mp4
', m3u8_id='hls
', fatal=False))
47 formats.extend(self._extract_f4m_formats(
48 stream_url, video_id, f4m_id='hds
', fatal=False))
49 self._sort_formats(formats)
55 'description
': self._og_search_description(webpage),
56 'thumbnail
': self._og_search_thumbnail(webpage),