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.

37 lines
1.2 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. # The md5 checksum changes
  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. 'formats': self._extract_f4m_formats(f4m_url, name),
  28. 'description': self._og_search_description(webpage),
  29. 'thumbnail': self._og_search_thumbnail(webpage),
  30. }