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