]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/macgamestore.py
debian/watch: Make use of the signing key from upstream.
[youtubedl] / youtube_dl / extractor / macgamestore.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6 from ..utils import ExtractorError
7
8
9 class MacGameStoreIE(InfoExtractor):
10 IE_NAME = 'macgamestore'
11 IE_DESC = 'MacGameStore trailers'
12 _VALID_URL = r'https?://www\.macgamestore\.com/mediaviewer\.php\?trailer=(?P<id>\d+)'
13
14 _TEST = {
15 'url': 'http://www.macgamestore.com/mediaviewer.php?trailer=2450',
16 'file': '2450.m4v',
17 'md5': '8649b8ea684b6666b4c5be736ecddc61',
18 'info_dict': {
19 'title': 'Crow',
20 }
21 }
22
23 def _real_extract(self, url):
24 mobj = re.match(self._VALID_URL, url)
25 video_id = mobj.group('id')
26
27 webpage = self._download_webpage(url, video_id, 'Downloading trailer page')
28
29 if re.search(r'>Missing Media<', webpage) is not None:
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
39 return {
40 'id': video_id,
41 'url': video_url,
42 'title': video_title
43 }