]> gitweb @ CieloNegro.org - youtube-dl.git/blob - youtube_dl/extractor/videodetective.py
[downloader/hls] Use the correct program when reporting an error
[youtube-dl.git] / youtube_dl / extractor / videodetective.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6 from .internetvideoarchive import InternetVideoArchiveIE
7 from ..utils import compat_urlparse
8
9
10 class VideoDetectiveIE(InfoExtractor):
11     _VALID_URL = r'https?://www\.videodetective\.com/[^/]+/[^/]+/(?P<id>\d+)'
12
13     _TEST = {
14         'url': 'http://www.videodetective.com/movies/kick-ass-2/194487',
15         'info_dict': {
16             'id': '194487',
17             'ext': 'mp4',
18             'title': 'KICK-ASS 2',
19             'description': 'md5:65ba37ad619165afac7d432eaded6013',
20             'duration': 135,
21         },
22     }
23
24     def _real_extract(self, url):
25         mobj = re.match(self._VALID_URL, url)
26         video_id = mobj.group('id')
27         webpage = self._download_webpage(url, video_id)
28         og_video = self._og_search_video_url(webpage)
29         query = compat_urlparse.urlparse(og_video).query
30         return self.url_result(InternetVideoArchiveIE._build_url(query), ie=InternetVideoArchiveIE.ie_key())