3 from .common
import InfoExtractor
12 class SunPornoIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:(?:www\.)?sunporno\.com/videos|embeds\.sunporno\.com/embed)/(?P<id>\d+)'
15 'url': 'http://www.sunporno.com/videos/807778/',
16 'md5': '507887e29033502f29dba69affeebfc9',
20 'title': 'md5:0a400058e8105d39e35c35e7c5184164',
21 'description': 'md5:a31241990e1bd3a64e72ae99afb325fb',
22 'thumbnail': r
're:^https?://.*\.jpg$',
27 'url': 'http://embeds.sunporno.com/embed/807778',
28 'only_matching': True,
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
34 webpage
= self
._download
_webpage
(
35 f
'http://www.sunporno.com/videos/{video_id}', video_id
)
37 title
= self
._html
_extract
_title
(webpage
)
38 description
= self
._html
_search
_meta
(
39 'description', webpage
, 'description')
40 thumbnail
= self
._html
_search
_regex
(
41 r
'poster="([^"]+)"', webpage
, 'thumbnail', fatal
=False)
43 duration
= parse_duration(self
._search
_regex
(
44 (r
'itemprop="duration"[^>]*>\s*(\d+:\d+)\s*<',
45 r
'>Duration:\s*<span[^>]+>\s*(\d+:\d+)\s*<'),
46 webpage
, 'duration', fatal
=False))
48 view_count
= int_or_none(self
._html
_search
_regex
(
49 r
'class="views">(?:<noscript>)?\s*(\d+)\s*<',
50 webpage
, 'view count', fatal
=False))
51 comment_count
= int_or_none(self
._html
_search
_regex
(
52 r
'(\d+)</b> Comments?',
53 webpage
, 'comment count', fatal
=False, default
=None))
56 quality
= qualities(['mp4', 'flv'])
57 for video_url
in re
.findall(r
'<(?:source|video) src="([^"]+)"', webpage
):
58 video_ext
= determine_ext(video_url
)
61 'format_id': video_ext
,
62 'quality': quality(video_ext
),
68 'description': description
,
69 'thumbnail': thumbnail
,
71 'view_count': view_count
,
72 'comment_count': comment_count
,