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.

43 lines
1.3 KiB

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