You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1004 B

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from .internetvideoarchive import InternetVideoArchiveIE
  5. from ..utils import compat_urlparse
  6. class VideoDetectiveIE(InfoExtractor):
  7. _VALID_URL = r'https?://www\.videodetective\.com/[^/]+/[^/]+/(?P<id>\d+)'
  8. _TEST = {
  9. 'url': 'http://www.videodetective.com/movies/kick-ass-2/194487',
  10. 'info_dict': {
  11. 'id': '194487',
  12. 'ext': 'mp4',
  13. 'title': 'KICK-ASS 2',
  14. 'description': 'md5:65ba37ad619165afac7d432eaded6013',
  15. 'duration': 135,
  16. },
  17. }
  18. def _real_extract(self, url):
  19. mobj = re.match(self._VALID_URL, url)
  20. video_id = mobj.group('id')
  21. webpage = self._download_webpage(url, video_id)
  22. og_video = self._og_search_video_url(webpage)
  23. query = compat_urlparse.urlparse(og_video).query
  24. return self.url_result(InternetVideoArchiveIE._build_url(query), ie=InternetVideoArchiveIE.ie_key())