]>
Commit | Line | Data |
---|---|---|
85689a53 PH |
1 | from __future__ import unicode_literals |
2 | ||
1e923b0d | 3 | from .common import InfoExtractor |
4 | from ..utils import ExtractorError | |
5 | ||
6 | ||
7 | class MacGameStoreIE(InfoExtractor): | |
85689a53 PH |
8 | IE_NAME = 'macgamestore' |
9 | IE_DESC = 'MacGameStore trailers' | |
1e923b0d | 10 | _VALID_URL = r'https?://www\.macgamestore\.com/mediaviewer\.php\?trailer=(?P<id>\d+)' |
11 | ||
12 | _TEST = { | |
85689a53 | 13 | 'url': 'http://www.macgamestore.com/mediaviewer.php?trailer=2450', |
85689a53 PH |
14 | 'md5': '8649b8ea684b6666b4c5be736ecddc61', |
15 | 'info_dict': { | |
c1f06d63 PH |
16 | 'id': '2450', |
17 | 'ext': 'm4v', | |
85689a53 | 18 | 'title': 'Crow', |
1e923b0d | 19 | } |
20 | } | |
21 | ||
22 | def _real_extract(self, url): | |
c1f06d63 PH |
23 | video_id = self._match_id(url) |
24 | webpage = self._download_webpage( | |
25 | url, video_id, 'Downloading trailer page') | |
85689a53 | 26 | |
c1f06d63 PH |
27 | if '>Missing Media<' in webpage: |
28 | raise ExtractorError( | |
29 | 'Trailer %s does not exist' % video_id, expected=True) | |
85689a53 PH |
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 | ||
1e923b0d | 38 | return { |
39 | 'id': video_id, | |
40 | 'url': video_url, | |
41 | 'title': video_title | |
85689a53 | 42 | } |