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.

43 lines
1.4 KiB

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