]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tnaflix.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class TNAFlixIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?tnaflix\.com/(?P<cat_id>[\w-]+)/(?P<display_id>[\w-]+)/video(?P<id>\d+)'
15 _TITLE_REGEX
= r
'<title>(.+?) - TNAFlix Porn Videos</title>'
16 _DESCRIPTION_REGEX
= r
'<h3 itemprop="description">([^<]+)</h3>'
17 _CONFIG_REGEX
= r
'flashvars\.config\s*=\s*escape\("([^"]+)"'
20 'url': 'http://www.tnaflix.com/porn-stars/Carmella-Decesare-striptease/video553878',
21 'md5': 'ecf3498417d09216374fc5907f9c6ec0',
24 'display_id': 'Carmella-Decesare-striptease',
26 'title': 'Carmella Decesare - striptease',
28 'thumbnail': 're:https?://.*\.jpg$',
34 def _real_extract(self
, url
):
35 mobj
= re
.match(self
._VALID
_URL
, url
)
36 video_id
= mobj
.group('id')
37 display_id
= mobj
.group('display_id')
39 webpage
= self
._download
_webpage
(url
, display_id
)
41 title
= self
._html
_search
_regex
(
42 self
._TITLE
_REGEX
, webpage
, 'title') if self
._TITLE
_REGEX
else self
._og
_search
_title
(webpage
)
43 description
= self
._html
_search
_regex
(
44 self
._DESCRIPTION
_REGEX
, webpage
, 'description', fatal
=False, default
='')
46 age_limit
= self
._rta
_search
(webpage
)
48 duration
= self
._html
_search
_meta
('duration', webpage
, 'duration', default
=None)
50 duration
= parse_duration(duration
[1:])
52 cfg_url
= self
._proto
_relative
_url
(self
._html
_search
_regex
(
53 self
._CONFIG
_REGEX
, webpage
, 'flashvars.config'), 'http:')
55 cfg_xml
= self
._download
_xml
(
56 cfg_url
, display_id
, note
='Downloading metadata',
57 transform_source
=fix_xml_ampersands
)
59 thumbnail
= cfg_xml
.find('./startThumb').text
62 for item
in cfg_xml
.findall('./quality/item'):
63 video_url
= re
.sub('speed=\d+', 'speed=', item
.find('videoLink').text
)
64 format_id
= item
.find('res').text
67 'format_id': format_id
,
69 m
= re
.search(r
'^(\d+)', format_id
)
71 fmt
['height'] = int(m
.group(1))
73 self
._sort
_formats
(formats
)
77 'display_id': display_id
,
79 'description': description
,
80 'thumbnail': thumbnail
,
82 'age_limit': age_limit
,