]>
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<display_id>[^/]+)/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\("([^"]+)"'
21 'url': 'http://www.tnaflix.com/porn-stars/Carmella-Decesare-striptease/video553878',
22 'md5': 'ecf3498417d09216374fc5907f9c6ec0',
25 'display_id': 'Carmella-Decesare-striptease',
27 'title': 'Carmella Decesare - striptease',
29 'thumbnail': 're:https?://.*\.jpg$',
35 'url': 'https://www.tnaflix.com/amateur-porn/bunzHD-Ms.Donk/video358632',
36 'only_matching': True,
40 def _real_extract(self
, url
):
41 mobj
= re
.match(self
._VALID
_URL
, url
)
42 video_id
= mobj
.group('id')
43 display_id
= mobj
.group('display_id')
45 webpage
= self
._download
_webpage
(url
, display_id
)
47 title
= self
._html
_search
_regex
(
48 self
._TITLE
_REGEX
, webpage
, 'title') if self
._TITLE
_REGEX
else self
._og
_search
_title
(webpage
)
49 description
= self
._html
_search
_regex
(
50 self
._DESCRIPTION
_REGEX
, webpage
, 'description', fatal
=False, default
='')
52 age_limit
= self
._rta
_search
(webpage
)
54 duration
= parse_duration(self
._html
_search
_meta
(
55 'duration', webpage
, 'duration', default
=None))
57 cfg_url
= self
._proto
_relative
_url
(self
._html
_search
_regex
(
58 self
._CONFIG
_REGEX
, webpage
, 'flashvars.config'), 'http:')
60 cfg_xml
= self
._download
_xml
(
61 cfg_url
, display_id
, note
='Downloading metadata',
62 transform_source
=fix_xml_ampersands
)
64 thumbnail
= self
._proto
_relative
_url
(
65 cfg_xml
.find('./startThumb').text
, 'http:')
68 for item
in cfg_xml
.findall('./quality/item'):
69 video_url
= re
.sub('speed=\d+', 'speed=', item
.find('videoLink').text
)
70 format_id
= item
.find('res').text
72 'url': self
._proto
_relative
_url
(video_url
, 'http:'),
73 'format_id': format_id
,
75 m
= re
.search(r
'^(\d+)', format_id
)
77 fmt
['height'] = int(m
.group(1))
79 self
._sort
_formats
(formats
)
83 'display_id': display_id
,
85 'description': description
,
86 'thumbnail': thumbnail
,
88 'age_limit': age_limit
,