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