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.

58 lines
1.8 KiB

  1. from __future__ import unicode_literals
  2. import os
  3. import re
  4. from .common import InfoExtractor
  5. from ..compat import (
  6. compat_urllib_parse_urlparse,
  7. compat_urllib_request,
  8. )
  9. class KeezMoviesIE(InfoExtractor):
  10. _VALID_URL = r'https?://(?:www\.)?keezmovies\.com/video/.+?(?P<id>[0-9]+)(?:[/?&]|$)'
  11. _TEST = {
  12. 'url': 'http://www.keezmovies.com/video/petite-asian-lady-mai-playing-in-bathtub-1214711',
  13. 'md5': '6e297b7e789329923fcf83abb67c9289',
  14. 'info_dict': {
  15. 'id': '1214711',
  16. 'ext': 'mp4',
  17. 'title': 'Petite Asian Lady Mai Playing In Bathtub',
  18. 'age_limit': 18,
  19. }
  20. }
  21. def _real_extract(self, url):
  22. video_id = self._match_id(url)
  23. req = compat_urllib_request.Request(url)
  24. req.add_header('Cookie', 'age_verified=1')
  25. webpage = self._download_webpage(req, video_id)
  26. # embedded video
  27. mobj = re.search(r'href="([^"]+)"></iframe>', webpage)
  28. if mobj:
  29. embedded_url = mobj.group(1)
  30. return self.url_result(embedded_url)
  31. video_title = self._html_search_regex(
  32. r'<h1 [^>]*>([^<]+)', webpage, 'title')
  33. video_url = self._html_search_regex(
  34. r'(?s)html5VideoPlayer = .*?src="([^"]+)"', webpage, 'video URL')
  35. path = compat_urllib_parse_urlparse(video_url).path
  36. extension = os.path.splitext(path)[1][1:]
  37. format = path.split('/')[4].split('_')[:2]
  38. format = "-".join(format)
  39. age_limit = self._rta_search(webpage)
  40. return {
  41. 'id': video_id,
  42. 'title': video_title,
  43. 'url': video_url,
  44. 'ext': extension,
  45. 'format': format,
  46. 'format_id': format,
  47. 'age_limit': age_limit,
  48. }