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