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.

90 lines
3.2 KiB

  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 WatchIndianPornIE(InfoExtractor):
  11. IE_DESC = 'Watch Indian Porn'
  12. _VALID_URL = r'https?://(?:www\.)?watchindianporn\.net/(?:[^/]+/)*video/(?P<display_id>[^/]+)-(?P<id>[a-zA-Z0-9]+)\.html'
  13. _TEST = {
  14. 'url': 'http://www.watchindianporn.net/video/hot-milf-from-kerala-shows-off-her-gorgeous-large-breasts-on-camera-RZa2avywNPa.html',
  15. 'md5': '249589a164dde236ec65832bfce17440',
  16. 'info_dict': {
  17. 'id': 'RZa2avywNPa',
  18. 'display_id': 'hot-milf-from-kerala-shows-off-her-gorgeous-large-breasts-on-camera',
  19. 'ext': 'mp4',
  20. 'title': 'Hot milf from kerala shows off her gorgeous large breasts on camera',
  21. 'thumbnail': r're:^https?://.*\.jpg$',
  22. 'uploader': 'LoveJay',
  23. 'upload_date': '20160428',
  24. 'duration': 226,
  25. 'view_count': int,
  26. 'comment_count': int,
  27. 'categories': list,
  28. 'age_limit': 18,
  29. }
  30. }
  31. def _real_extract(self, url):
  32. mobj = re.match(self._VALID_URL, url)
  33. video_id = mobj.group('id')
  34. display_id = mobj.group('display_id')
  35. webpage = self._download_webpage(url, display_id)
  36. video_url = self._html_search_regex(
  37. r"url: escape\('([^']+)'\)", webpage, 'url')
  38. title = self._html_search_regex(
  39. r'<h2 class="he2"><span>(.*?)</span>',
  40. webpage, 'title')
  41. thumbnail = self._html_search_regex(
  42. r'<span id="container"><img\s+src="([^"]+)"',
  43. webpage, 'thumbnail', fatal=False)
  44. uploader = self._html_search_regex(
  45. r'class="aupa">\s*(.*?)</a>',
  46. webpage, 'uploader')
  47. upload_date = unified_strdate(self._html_search_regex(
  48. r'Added: <strong>(.+?)</strong>', webpage, 'upload date', fatal=False))
  49. duration = parse_duration(self._search_regex(
  50. r'<td>Time:\s*</td>\s*<td align="right"><span>\s*(.+?)\s*</span>',
  51. webpage, 'duration', fatal=False))
  52. view_count = int_or_none(self._search_regex(
  53. r'<td>Views:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
  54. webpage, 'view count', fatal=False))
  55. comment_count = int_or_none(self._search_regex(
  56. r'<td>Comments:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
  57. webpage, 'comment count', fatal=False))
  58. categories = re.findall(
  59. r'<a href="[^"]+/search/video/desi"><span>([^<]+)</span></a>',
  60. webpage)
  61. return {
  62. 'id': video_id,
  63. 'display_id': display_id,
  64. 'url': video_url,
  65. 'http_headers': {
  66. 'Referer': url,
  67. },
  68. 'title': title,
  69. 'thumbnail': thumbnail,
  70. 'uploader': uploader,
  71. 'upload_date': upload_date,
  72. 'duration': duration,
  73. 'view_count': view_count,
  74. 'comment_count': comment_count,
  75. 'categories': categories,
  76. 'age_limit': 18,
  77. }