logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

watchindianporn.py (2297B)


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