]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sunporno.py
ef9be7926866f6420d802f14cfdf83b3a9e4f69b
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
14 class SunPornoIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:(?:www\.)?sunporno\.com/videos|embeds\.sunporno\.com/embed)/(?P<id>\d+)'
17 'url': 'http://www.sunporno.com/videos/807778/',
18 'md5': '507887e29033502f29dba69affeebfc9',
22 'title': 'md5:0a400058e8105d39e35c35e7c5184164',
23 'description': 'md5:a31241990e1bd3a64e72ae99afb325fb',
24 'thumbnail': 're:^https?://.*\.jpg$',
29 'url': 'http://embeds.sunporno.com/embed/807778',
30 'only_matching': True,
33 def _real_extract(self
, url
):
34 video_id
= self
._match
_id
(url
)
36 webpage
= self
._download
_webpage
(
37 'http://www.sunporno.com/videos/%s' % video_id
, video_id
)
39 title
= self
._html
_search
_regex
(
40 r
'<title>([^<]+)</title>', webpage
, 'title')
41 description
= self
._html
_search
_meta
(
42 'description', webpage
, 'description')
43 thumbnail
= self
._html
_search
_regex
(
44 r
'poster="([^"]+)"', webpage
, 'thumbnail', fatal
=False)
46 duration
= parse_duration(self
._search
_regex
(
47 (r
'itemprop="duration"[^>]*>\s*(\d+:\d+)\s*<',
48 r
'>Duration:\s*<span[^>]+>\s*(\d+:\d+)\s*<'),
49 webpage
, 'duration', fatal
=False))
51 view_count
= int_or_none(self
._html
_search
_regex
(
52 r
'class="views">(?:<noscript>)?\s*(\d+)\s*<',
53 webpage
, 'view count', fatal
=False))
54 comment_count
= int_or_none(self
._html
_search
_regex
(
55 r
'(\d+)</b> Comments?',
56 webpage
, 'comment count', fatal
=False, default
=None))
59 quality
= qualities(['mp4', 'flv'])
60 for video_url
in re
.findall(r
'<(?:source|video) src="([^"]+)"', webpage
):
61 video_ext
= determine_ext(video_url
)
64 'format_id': video_ext
,
65 'quality': quality(video_ext
),
67 self
._sort
_formats
(formats
)
72 'description': description
,
73 'thumbnail': thumbnail
,
75 'view_count': view_count
,
76 'comment_count': comment_count
,