You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

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