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.

40 lines
1.4 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from .ooyala import OoyalaIE
  4. from ..utils import ExtractorError
  5. class ViceIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)+(?P<id>.+)'
  7. _TESTS = [
  8. {
  9. 'url': 'http://www.vice.com/Fringes/cowboy-capitalists-part-1',
  10. 'info_dict': {
  11. 'id': '43cW1mYzpia9IlestBjVpd23Yu3afAfp',
  12. 'ext': 'mp4',
  13. 'title': 'VICE_COWBOYCAPITALISTS_PART01_v1_VICE_WM_1080p.mov',
  14. 'duration': 725.983,
  15. },
  16. 'params': {
  17. # Requires ffmpeg (m3u8 manifest)
  18. 'skip_download': True,
  19. },
  20. }, {
  21. 'url': 'https://news.vice.com/video/experimenting-on-animals-inside-the-monkey-lab',
  22. 'only_matching': True,
  23. }
  24. ]
  25. def _real_extract(self, url):
  26. video_id = self._match_id(url)
  27. webpage = self._download_webpage(url, video_id)
  28. try:
  29. embed_code = self._search_regex(
  30. r'embedCode=([^&\'"]+)', webpage,
  31. 'ooyala embed code')
  32. ooyala_url = OoyalaIE._url_for_embed_code(embed_code)
  33. except ExtractorError:
  34. raise ExtractorError('The page doesn\'t contain a video', expected=True)
  35. return self.url_result(ooyala_url, ie='Ooyala')