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.

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