pornez.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from .common import InfoExtractor
  2. from ..utils import int_or_none
  3. class PornezIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?pornez\.net/video(?P<id>[0-9]+)/'
  5. _TEST = {
  6. 'url': 'https://pornez.net/video344819/mistresst-funny_penis_names-wmv/',
  7. 'md5': '2e19a0a1cff3a5dbea0ef1b9e80bcbbc',
  8. 'info_dict': {
  9. 'id': '344819',
  10. 'ext': 'mp4',
  11. 'title': r'mistresst funny_penis_names wmv',
  12. 'thumbnail': r're:^https?://.*\.jpg$',
  13. 'age_limit': 18,
  14. }
  15. }
  16. def _real_extract(self, url):
  17. video_id = self._match_id(url)
  18. webpage = self._download_webpage(url, video_id)
  19. iframe_src = self._html_search_regex(
  20. r'<iframe[^>]+src="(https?://pornez\.net/player/\?[^"]+)"', webpage, 'iframe', fatal=True)
  21. title = self._html_search_meta(['name', 'twitter:title', 'og:title'], webpage, 'title', default=None)
  22. if title is None:
  23. title = self._search_regex(r'<h1>(.*?)</h1>', webpage, 'title', fatal=True)
  24. thumbnail = self._html_search_meta(['thumbnailUrl'], webpage, 'title', default=None)
  25. webpage = self._download_webpage(iframe_src, video_id)
  26. entries = self._parse_html5_media_entries(iframe_src, webpage, video_id)[0]
  27. for format in entries['formats']:
  28. height = self._search_regex(r'_(\d+)\.m3u8', format['url'], 'height')
  29. format['format_id'] = '%sp' % height
  30. format['height'] = int_or_none(height)
  31. entries.update({
  32. 'id': video_id,
  33. 'title': title,
  34. 'thumbnail': thumbnail,
  35. 'age_limit': 18
  36. })
  37. return entries