]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/bloomberg.py
Merge branch 'ustream-embed-recorded2' of https://github.com/anovicecodemonkey/youtub...
[youtube-dl] / youtube_dl / extractor / bloomberg.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class BloombergIE(InfoExtractor):
9     _VALID_URL = r'https?://www\.bloomberg\.com/video/(?P<name>.+?)\.html'
10
11     _TEST = {
12         'url': 'http://www.bloomberg.com/video/shah-s-presentation-on-foreign-exchange-strategies-qurhIVlJSB6hzkVi229d8g.html',
13         'md5': '7bf08858ff7c203c870e8a6190e221e5',
14         'info_dict': {
15             'id': 'qurhIVlJSB6hzkVi229d8g',
16             'ext': 'flv',
17             'title': 'Shah\'s Presentation on Foreign-Exchange Strategies',
18             'description': 'md5:0681e0d30dcdfc6abf34594961d8ea88',
19         },
20     }
21
22     def _real_extract(self, url):
23         mobj = re.match(self._VALID_URL, url)
24         name = mobj.group('name')
25         webpage = self._download_webpage(url, name)
26         f4m_url = self._search_regex(
27             r'<source src="(https?://[^"]+\.f4m.*?)"', webpage,
28             'f4m url')
29         title = re.sub(': Video$', '', self._og_search_title(webpage))
30
31         return {
32             'id': name.split('-')[-1],
33             'title': title,
34             'url': f4m_url,
35             'ext': 'flv',
36             'description': self._og_search_description(webpage),
37             'thumbnail': self._og_search_thumbnail(webpage),
38         }