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.

121 lines
4.3 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import (
  6. unified_strdate,
  7. parse_duration,
  8. int_or_none,
  9. )
  10. class SexyKarmaIE(InfoExtractor):
  11. IE_DESC = 'Sexy Karma and Watch Indian Porn'
  12. _VALID_URL = r'https?://(?:www\.)?(?:sexykarma\.com|watchindianporn\.net)/(?:[^/]+/)*video/(?P<display_id>[^/]+)-(?P<id>[a-zA-Z0-9]+)\.html'
  13. _TESTS = [{
  14. 'url': 'http://www.sexykarma.com/gonewild/video/taking-a-quick-pee-yHI70cOyIHt.html',
  15. 'md5': 'b9798e7d1ef1765116a8f516c8091dbd',
  16. 'info_dict': {
  17. 'id': 'yHI70cOyIHt',
  18. 'display_id': 'taking-a-quick-pee',
  19. 'ext': 'mp4',
  20. 'title': 'Taking a quick pee.',
  21. 'thumbnail': 're:^https?://.*\.jpg$',
  22. 'uploader': 'wildginger7',
  23. 'upload_date': '20141008',
  24. 'duration': 22,
  25. 'view_count': int,
  26. 'comment_count': int,
  27. 'categories': list,
  28. 'age_limit': 18,
  29. }
  30. }, {
  31. 'url': 'http://www.sexykarma.com/gonewild/video/pot-pixie-tribute-8Id6EZPbuHf.html',
  32. 'md5': 'dd216c68d29b49b12842b9babe762a5d',
  33. 'info_dict': {
  34. 'id': '8Id6EZPbuHf',
  35. 'display_id': 'pot-pixie-tribute',
  36. 'ext': 'mp4',
  37. 'title': 'pot_pixie tribute',
  38. 'thumbnail': 're:^https?://.*\.jpg$',
  39. 'uploader': 'banffite',
  40. 'upload_date': '20141013',
  41. 'duration': 16,
  42. 'view_count': int,
  43. 'comment_count': int,
  44. 'categories': list,
  45. 'age_limit': 18,
  46. }
  47. }, {
  48. 'url': 'http://www.watchindianporn.net/video/desi-dancer-namrata-stripping-completely-nude-and-dancing-on-a-hot-number-dW2mtctxJfs.html',
  49. 'md5': '9afb80675550406ed9a63ac2819ef69d',
  50. 'info_dict': {
  51. 'id': 'dW2mtctxJfs',
  52. 'display_id': 'desi-dancer-namrata-stripping-completely-nude-and-dancing-on-a-hot-number',
  53. 'ext': 'mp4',
  54. 'title': 'Desi dancer namrata stripping completely nude and dancing on a hot number',
  55. 'thumbnail': 're:^https?://.*\.jpg$',
  56. 'uploader': 'Don',
  57. 'upload_date': '20140213',
  58. 'duration': 83,
  59. 'view_count': int,
  60. 'comment_count': int,
  61. 'categories': list,
  62. 'age_limit': 18,
  63. }
  64. }]
  65. def _real_extract(self, url):
  66. mobj = re.match(self._VALID_URL, url)
  67. video_id = mobj.group('id')
  68. display_id = mobj.group('display_id')
  69. webpage = self._download_webpage(url, display_id)
  70. video_url = self._html_search_regex(
  71. r"url: escape\('([^']+)'\)", webpage, 'url')
  72. title = self._html_search_regex(
  73. r'<h2 class="he2"><span>(.*?)</span>',
  74. webpage, 'title')
  75. thumbnail = self._html_search_regex(
  76. r'<span id="container"><img\s+src="([^"]+)"',
  77. webpage, 'thumbnail', fatal=False)
  78. uploader = self._html_search_regex(
  79. r'class="aupa">\s*(.*?)</a>',
  80. webpage, 'uploader')
  81. upload_date = unified_strdate(self._html_search_regex(
  82. r'Added: <strong>(.+?)</strong>', webpage, 'upload date', fatal=False))
  83. duration = parse_duration(self._search_regex(
  84. r'<td>Time:\s*</td>\s*<td align="right"><span>\s*(.+?)\s*</span>',
  85. webpage, 'duration', fatal=False))
  86. view_count = int_or_none(self._search_regex(
  87. r'<td>Views:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
  88. webpage, 'view count', fatal=False))
  89. comment_count = int_or_none(self._search_regex(
  90. r'<td>Comments:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
  91. webpage, 'comment count', fatal=False))
  92. categories = re.findall(
  93. r'<a href="[^"]+/search/video/desi"><span>([^<]+)</span></a>',
  94. webpage)
  95. return {
  96. 'id': video_id,
  97. 'display_id': display_id,
  98. 'url': video_url,
  99. 'title': title,
  100. 'thumbnail': thumbnail,
  101. 'uploader': uploader,
  102. 'upload_date': upload_date,
  103. 'duration': duration,
  104. 'view_count': view_count,
  105. 'comment_count': comment_count,
  106. 'categories': categories,
  107. 'age_limit': 18,
  108. }