]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videodetective.py
Merge tag 'upstream/2013.12.23'
[youtubedl] / youtube_dl / extractor / videodetective.py
1 import re
2
3 from .common import InfoExtractor
4 from .internetvideoarchive import InternetVideoArchiveIE
5 from ..utils import (
6 compat_urlparse,
7 )
8
9
10 class VideoDetectiveIE(InfoExtractor):
11 _VALID_URL = r'https?://www\.videodetective\.com/[^/]+/[^/]+/(?P<id>\d+)'
12
13 _TEST = {
14 u'url': u'http://www.videodetective.com/movies/kick-ass-2/194487',
15 u'file': u'194487.mp4',
16 u'info_dict': {
17 u'title': u'KICK-ASS 2',
18 u'description': u'md5:65ba37ad619165afac7d432eaded6013',
19 u'duration': 135,
20 },
21 }
22
23 def _real_extract(self, url):
24 mobj = re.match(self._VALID_URL, url)
25 video_id = mobj.group('id')
26 webpage = self._download_webpage(url, video_id)
27 og_video = self._og_search_video_url(webpage)
28 query = compat_urlparse.urlparse(og_video).query
29 return self.url_result(InternetVideoArchiveIE._build_url(query),
30 ie=InternetVideoArchiveIE.ie_key())