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.

54 lines
1.7 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import (
  4. parse_duration,
  5. urljoin,
  6. )
  7. class YourPornIE(InfoExtractor):
  8. _VALID_URL = r'https?://(?:www\.)?yourporn\.sexy/post/(?P<id>[^/?#&.]+)'
  9. _TEST = {
  10. 'url': 'https://yourporn.sexy/post/57ffcb2e1179b.html',
  11. 'md5': '6f8682b6464033d87acaa7a8ff0c092e',
  12. 'info_dict': {
  13. 'id': '57ffcb2e1179b',
  14. 'ext': 'mp4',
  15. 'title': 'md5:c9f43630bd968267672651ba905a7d35',
  16. 'thumbnail': r're:^https?://.*\.jpg$',
  17. 'duration': 165,
  18. 'age_limit': 18,
  19. },
  20. 'params': {
  21. 'skip_download': True,
  22. },
  23. }
  24. def _real_extract(self, url):
  25. video_id = self._match_id(url)
  26. webpage = self._download_webpage(url, video_id)
  27. video_url = urljoin(url, self._parse_json(
  28. self._search_regex(
  29. r'data-vnfo=(["\'])(?P<data>{.+?})\1', webpage, 'data info',
  30. group='data'),
  31. video_id)[video_id]).replace('/cdn/', '/cdn4/')
  32. title = (self._search_regex(
  33. r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title',
  34. default=None) or self._og_search_description(webpage)).strip()
  35. thumbnail = self._og_search_thumbnail(webpage)
  36. duration = parse_duration(self._search_regex(
  37. r'duration\s*:\s*<[^>]+>([\d:]+)', webpage, 'duration',
  38. default=None))
  39. return {
  40. 'id': video_id,
  41. 'url': video_url,
  42. 'title': title,
  43. 'thumbnail': thumbnail,
  44. 'duration': duration,
  45. 'age_limit': 18,
  46. }