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.

39 lines
1.3 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. },
  15. 'params': {
  16. # Requires ffmpeg (m3u8 manifest)
  17. 'skip_download': True,
  18. },
  19. }, {
  20. 'url': 'https://news.vice.com/video/experimenting-on-animals-inside-the-monkey-lab',
  21. 'only_matching': True,
  22. }
  23. ]
  24. def _real_extract(self, url):
  25. video_id = self._match_id(url)
  26. webpage = self._download_webpage(url, video_id)
  27. try:
  28. embed_code = self._search_regex(
  29. r'embedCode=([^&\'"]+)', webpage,
  30. 'ooyala embed code')
  31. ooyala_url = OoyalaIE._url_for_embed_code(embed_code)
  32. except ExtractorError:
  33. raise ExtractorError('The page doesn\'t contain a video', expected=True)
  34. return self.url_result(ooyala_url, ie='Ooyala')