watchindianporn.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import re
  2. from .common import InfoExtractor
  3. from ..utils import parse_duration
  4. class WatchIndianPornIE(InfoExtractor):
  5. IE_DESC = 'Watch Indian Porn'
  6. _VALID_URL = r'https?://(?:www\.)?watchindianporn\.net/(?:[^/]+/)*video/(?P<display_id>[^/]+)-(?P<id>[a-zA-Z0-9]+)\.html'
  7. _TEST = {
  8. 'url': 'http://www.watchindianporn.net/video/hot-milf-from-kerala-shows-off-her-gorgeous-large-breasts-on-camera-RZa2avywNPa.html',
  9. 'md5': '249589a164dde236ec65832bfce17440',
  10. 'info_dict': {
  11. 'id': 'RZa2avywNPa',
  12. 'display_id': 'hot-milf-from-kerala-shows-off-her-gorgeous-large-breasts-on-camera',
  13. 'ext': 'mp4',
  14. 'title': 'Hot milf from kerala shows off her gorgeous large breasts on camera',
  15. 'thumbnail': r're:^https?://.*\.jpg$',
  16. 'duration': 226,
  17. 'view_count': int,
  18. 'categories': list,
  19. 'age_limit': 18,
  20. }
  21. }
  22. def _real_extract(self, url):
  23. mobj = self._match_valid_url(url)
  24. video_id = mobj.group('id')
  25. display_id = mobj.group('display_id')
  26. webpage = self._download_webpage(url, display_id)
  27. info_dict = self._parse_html5_media_entries(url, webpage, video_id)[0]
  28. title = self._html_search_regex((
  29. r'<title>(.+?)\s*-\s*Indian\s+Porn</title>',
  30. r'<h4>(.+?)</h4>'
  31. ), webpage, 'title')
  32. duration = parse_duration(self._search_regex(
  33. r'Time:\s*<strong>\s*(.+?)\s*</strong>',
  34. webpage, 'duration', fatal=False))
  35. view_count = int(self._search_regex(
  36. r'(?s)Time:\s*<strong>.*?</strong>.*?<strong>\s*(\d+)\s*</strong>',
  37. webpage, 'view count', fatal=False))
  38. categories = re.findall(
  39. r'<a[^>]+class=[\'"]categories[\'"][^>]*>\s*([^<]+)\s*</a>',
  40. webpage)
  41. info_dict.update({
  42. 'id': video_id,
  43. 'display_id': display_id,
  44. 'http_headers': {
  45. 'Referer': url,
  46. },
  47. 'title': title,
  48. 'duration': duration,
  49. 'view_count': view_count,
  50. 'categories': categories,
  51. 'age_limit': 18,
  52. })
  53. return info_dict