]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pornflip.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
16 class PornFlipIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?pornflip\.com/(?:v|embed)/(?P<id>[0-9A-Za-z]{11})'
19 'url': 'https://www.pornflip.com/v/wz7DfNhMmep',
20 'md5': '98c46639849145ae1fd77af532a9278c',
24 'title': '2 Amateurs swallow make his dream cumshots true',
25 'thumbnail': r
're:^https?://.*\.jpg$',
27 'timestamp': 1481655502,
28 'upload_date': '20161213',
29 'uploader_id': '106786',
30 'uploader': 'figifoto',
35 'url': 'https://www.pornflip.com/embed/wz7DfNhMmep',
36 'only_matching': True,
39 def _real_extract(self
, url
):
40 video_id
= self
._match
_id
(url
)
42 webpage
= self
._download
_webpage
(
43 'https://www.pornflip.com/v/%s' % video_id
, video_id
)
45 flashvars
= compat_parse_qs(self
._search
_regex
(
46 r
'<embed[^>]+flashvars=(["\'])(?P
<flashvars
>(?
:(?
!\
1).)+)\
1',
47 webpage, 'flashvars
', group='flashvars
'))
49 title = flashvars['video_vars
[title
]'][0]
53 flashvars, lambda x: x['video_vars
[%s]' % kind][0], compat_str)
56 for key, value in flashvars.items():
57 if not (value and isinstance(value, list)):
60 if key == 'video_vars
[hds_manifest
]':
61 formats.extend(self._extract_mpd_formats(
62 format_url, video_id, mpd_id='dash
', fatal=False))
64 height = self._search_regex(
65 r'video_vars\
[video_urls\
]\
[(\d
+)', key, 'height
', default=None)
70 'format_id
': 'http
-%s' % height,
71 'height
': int_or_none(height),
73 self._sort_formats(formats)
75 uploader = self._html_search_regex(
76 (r'<span
[^
>]+class="name"[^
>]*>\s
*<a
[^
>]+>\s
*<strong
>(?P
<uploader
>[^
<]+)',
77 r'<meta
[^
>]+content
=(["\'])[^>]*\buploaded by (?P<uploader>.+?)\1'),
78 webpage, 'uploader', fatal=False, group='uploader')
84 'thumbnail': flashvar('big_thumb'),
85 'duration': int_or_none(flashvar('duration')),
86 'timestamp': unified_timestamp(self._html_search_meta(
87 'uploadDate', webpage, 'timestamp')),
88 'uploader_id': flashvar('author_id'),
90 'view_count': int_or_none(flashvar('views')),