]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sunporno.py
8a333f1d24d6be3bd5160d843c3cd6451ef83178
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
14 class SunPornoIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?sunporno\.com/videos/(?P<id>\d+)'
17 'url': 'http://www.sunporno.com/videos/807778/',
18 'md5': '6457d3c165fd6de062b99ef6c2ff4c86',
22 'title': 'md5:0a400058e8105d39e35c35e7c5184164',
23 'description': 'md5:a31241990e1bd3a64e72ae99afb325fb',
24 'thumbnail': 're:^https?://.*\.jpg$',
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(url
, video_id
)
35 title
= self
._html
_search
_regex
(
36 r
'<title>([^<]+)</title>', webpage
, 'title')
37 description
= self
._html
_search
_meta
(
38 'description', webpage
, 'description')
39 thumbnail
= self
._html
_search
_regex
(
40 r
'poster="([^"]+)"', webpage
, 'thumbnail', fatal
=False)
42 duration
= parse_duration(self
._search
_regex
(
43 r
'itemprop="duration">\s*(\d+:\d+)\s*<',
44 webpage
, 'duration', fatal
=False))
46 view_count
= int_or_none(self
._html
_search
_regex
(
47 r
'class="views">\s*(\d+)\s*<',
48 webpage
, 'view count', fatal
=False))
49 comment_count
= int_or_none(self
._html
_search
_regex
(
50 r
'(\d+)</b> Comments?',
51 webpage
, 'comment count', fatal
=False))
54 quality
= qualities(['mp4', 'flv'])
55 for video_url
in re
.findall(r
'<source src="([^"]+)"', webpage
):
56 video_ext
= determine_ext(video_url
)
59 'format_id': video_ext
,
60 'quality': quality(video_ext
),
62 self
._sort
_formats
(formats
)
67 'description': description
,
68 'thumbnail': thumbnail
,
70 'view_count': view_count
,
71 'comment_count': comment_count
,