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.

41 lines
1.3 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. },
  15. }
  16. def _real_extract(self, url):
  17. video_id = self._match_id(url)
  18. webpage = self._download_webpage(url, video_id)
  19. video_url = urljoin(url, self._parse_json(
  20. self._search_regex(
  21. r'data-vnfo=(["\'])(?P<data>{.+?})\1', webpage, 'data info',
  22. group='data'),
  23. video_id)[video_id])
  24. title = (self._search_regex(
  25. r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title',
  26. default=None) or self._og_search_description(webpage)).strip()
  27. thumbnail = self._og_search_thumbnail(webpage)
  28. return {
  29. 'id': video_id,
  30. 'url': video_url,
  31. 'title': title,
  32. 'thumbnail': thumbnail,
  33. }