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.

81 lines
2.6 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. parse_duration,
  6. int_or_none,
  7. )
  8. class XXXYMoviesIE(InfoExtractor):
  9. _VALID_URL = r'https?://(?:www\.)?xxxymovies\.com/videos/(?P<id>\d+)/(?P<display_id>[^/]+)'
  10. _TEST = {
  11. 'url': 'http://xxxymovies.com/videos/138669/ecstatic-orgasm-sofcore/',
  12. 'md5': '810b1bdbbffff89dd13bdb369fe7be4b',
  13. 'info_dict': {
  14. 'id': '138669',
  15. 'display_id': 'ecstatic-orgasm-sofcore',
  16. 'ext': 'mp4',
  17. 'title': 'Ecstatic Orgasm Sofcore',
  18. 'duration': 931,
  19. 'categories': list,
  20. 'view_count': int,
  21. 'like_count': int,
  22. 'dislike_count': int,
  23. 'age_limit': 18,
  24. }
  25. }
  26. def _real_extract(self, url):
  27. mobj = re.match(self._VALID_URL, url)
  28. video_id = mobj.group('id')
  29. display_id = mobj.group('display_id')
  30. webpage = self._download_webpage(url, display_id)
  31. video_url = self._search_regex(
  32. r"video_url\s*:\s*'([^']+)'", webpage, 'video URL')
  33. title = self._html_search_regex(
  34. [r'<div[^>]+\bclass="block_header"[^>]*>\s*<h1>([^<]+)<',
  35. r'<title>(.*?)\s*-\s*(?:XXXYMovies\.com|XXX\s+Movies)</title>'],
  36. webpage, 'title')
  37. thumbnail = self._search_regex(
  38. r"preview_url\s*:\s*'([^']+)'",
  39. webpage, 'thumbnail', fatal=False)
  40. categories = self._html_search_meta(
  41. 'keywords', webpage, 'categories', default='').split(',')
  42. duration = parse_duration(self._search_regex(
  43. r'<span>Duration:</span>\s*(\d+:\d+)',
  44. webpage, 'duration', fatal=False))
  45. view_count = int_or_none(self._html_search_regex(
  46. r'<div class="video_views">\s*(\d+)',
  47. webpage, 'view count', fatal=False))
  48. like_count = int_or_none(self._search_regex(
  49. r'>\s*Likes? <b>\((\d+)\)',
  50. webpage, 'like count', fatal=False))
  51. dislike_count = int_or_none(self._search_regex(
  52. r'>\s*Dislike <b>\((\d+)\)</b>',
  53. webpage, 'dislike count', fatal=False))
  54. age_limit = self._rta_search(webpage)
  55. return {
  56. 'id': video_id,
  57. 'display_id': display_id,
  58. 'url': video_url,
  59. 'title': title,
  60. 'thumbnail': thumbnail,
  61. 'categories': categories,
  62. 'duration': duration,
  63. 'view_count': view_count,
  64. 'like_count': like_count,
  65. 'dislike_count': dislike_count,
  66. 'age_limit': age_limit,
  67. }