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.

61 lines
2.1 KiB

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