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.

120 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. }
  29. }, {
  30. 'url': 'http://www.sexykarma.com/gonewild/video/pot-pixie-tribute-8Id6EZPbuHf.html',
  31. 'md5': 'dd216c68d29b49b12842b9babe762a5d',
  32. 'info_dict': {
  33. 'id': '8Id6EZPbuHf',
  34. 'display_id': 'pot-pixie-tribute',
  35. 'ext': 'mp4',
  36. 'title': 'pot_pixie tribute',
  37. 'thumbnail': 're:^https?://.*\.jpg$',
  38. 'uploader': 'banffite',
  39. 'upload_date': '20141013',
  40. 'duration': 16,
  41. 'view_count': int,
  42. 'comment_count': int,
  43. 'categories': list,
  44. 'age_limit': 18,
  45. }
  46. }, {
  47. 'url': 'http://www.watchindianporn.net/video/desi-dancer-namrata-stripping-completely-nude-and-dancing-on-a-hot-number-dW2mtctxJfs.html',
  48. 'md5': '9afb80675550406ed9a63ac2819ef69d',
  49. 'info_dict': {
  50. 'id': 'dW2mtctxJfs',
  51. 'display_id': 'desi-dancer-namrata-stripping-completely-nude-and-dancing-on-a-hot-number',
  52. 'ext': 'mp4',
  53. 'title': 'Desi dancer namrata stripping completely nude and dancing on a hot number',
  54. 'thumbnail': 're:^https?://.*\.jpg$',
  55. 'uploader': 'Don',
  56. 'upload_date': '20140213',
  57. 'duration': 83,
  58. 'view_count': int,
  59. 'comment_count': int,
  60. 'categories': list,
  61. 'age_limit': 18,
  62. }
  63. }]
  64. def _real_extract(self, url):
  65. mobj = re.match(self._VALID_URL, url)
  66. video_id = mobj.group('id')
  67. display_id = mobj.group('display_id')
  68. webpage = self._download_webpage(url, display_id)
  69. video_url = self._html_search_regex(
  70. r"url: escape\('([^']+)'\)", webpage, 'url')
  71. title = self._html_search_regex(
  72. r'<h2 class="he2"><span>(.*?)</span>',
  73. webpage, 'title')
  74. thumbnail = self._html_search_regex(
  75. r'<span id="container"><img\s+src="([^"]+)"',
  76. webpage, 'thumbnail', fatal=False)
  77. uploader = self._html_search_regex(
  78. r'class="aupa">\s*(.*?)</a>',
  79. webpage, 'uploader')
  80. upload_date = unified_strdate(self._html_search_regex(
  81. r'Added: <strong>(.+?)</strong>', webpage, 'upload date', fatal=False))
  82. duration = parse_duration(self._search_regex(
  83. r'<td>Time:\s*</td>\s*<td align="right"><span>\s*(.+?)\s*</span>',
  84. webpage, 'duration', fatal=False))
  85. view_count = int_or_none(self._search_regex(
  86. r'<td>Views:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
  87. webpage, 'view count', fatal=False))
  88. comment_count = int_or_none(self._search_regex(
  89. r'<td>Comments:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
  90. webpage, 'comment count', fatal=False))
  91. categories = re.findall(
  92. r'<a href="[^"]+/search/video/desi"><span>([^<]+)</span></a>',
  93. webpage)
  94. return {
  95. 'id': video_id,
  96. 'display_id': display_id,
  97. 'url': video_url,
  98. 'title': title,
  99. 'thumbnail': thumbnail,
  100. 'uploader': uploader,
  101. 'upload_date': upload_date,
  102. 'duration': duration,
  103. 'view_count': view_count,
  104. 'comment_count': comment_count,
  105. 'categories': categories,
  106. 'age_limit': 18,
  107. }