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.

35 lines
1.2 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from .ooyala import OoyalaIE
  4. class FusionIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?fusion\.net/video/(?P<id>\d+)'
  6. _TESTS = [{
  7. 'url': 'http://fusion.net/video/201781/u-s-and-panamanian-forces-work-together-to-stop-a-vessel-smuggling-drugs/',
  8. 'info_dict': {
  9. 'id': 'ZpcWNoMTE6x6uVIIWYpHh0qQDjxBuq5P',
  10. 'ext': 'mp4',
  11. 'title': 'U.S. and Panamanian forces work together to stop a vessel smuggling drugs',
  12. 'description': 'md5:0cc84a9943c064c0f46b128b41b1b0d7',
  13. 'duration': 140.0,
  14. },
  15. 'params': {
  16. 'skip_download': True,
  17. },
  18. 'add_ie': ['Ooyala'],
  19. }, {
  20. 'url': 'http://fusion.net/video/201781',
  21. 'only_matching': True,
  22. }]
  23. def _real_extract(self, url):
  24. display_id = self._match_id(url)
  25. webpage = self._download_webpage(url, display_id)
  26. ooyala_code = self._search_regex(
  27. r'data-video-id=(["\'])(?P<code>.+?)\1',
  28. webpage, 'ooyala code', group='code')
  29. return OoyalaIE._build_url_result(ooyala_code)