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.

42 lines
1.2 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import ExtractorError
  4. class MacGameStoreIE(InfoExtractor):
  5. IE_NAME = 'macgamestore'
  6. IE_DESC = 'MacGameStore trailers'
  7. _VALID_URL = r'https?://www\.macgamestore\.com/mediaviewer\.php\?trailer=(?P<id>\d+)'
  8. _TEST = {
  9. 'url': 'http://www.macgamestore.com/mediaviewer.php?trailer=2450',
  10. 'md5': '8649b8ea684b6666b4c5be736ecddc61',
  11. 'info_dict': {
  12. 'id': '2450',
  13. 'ext': 'm4v',
  14. 'title': 'Crow',
  15. }
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. webpage = self._download_webpage(
  20. url, video_id, 'Downloading trailer page')
  21. if '>Missing Media<' in webpage:
  22. raise ExtractorError(
  23. 'Trailer %s does not exist' % video_id, expected=True)
  24. video_title = self._html_search_regex(
  25. r'<title>MacGameStore: (.*?) Trailer</title>', webpage, 'title')
  26. video_url = self._html_search_regex(
  27. r'(?s)<div\s+id="video-player".*?href="([^"]+)"\s*>',
  28. webpage, 'video URL')
  29. return {
  30. 'id': video_id,
  31. 'url': video_url,
  32. 'title': video_title
  33. }