1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
8 compat_urllib_parse_unquote
,
9 compat_urllib_parse_urlparse
,
10 compat_urllib_request
,
14 class MofosexIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?(?P<url>mofosex\.com/videos/(?P<id>[0-9]+)/.*?\.html)'
17 'url': 'http://www.mofosex.com/videos/5018/japanese-teen-music-video.html',
18 'md5': '1b2eb47ac33cc75d4a80e3026b613c5a',
22 'title': 'Japanese Teen Music Video',
27 def _real_extract(self
, url
):
28 mobj
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= mobj
.group('id')
30 url
= 'http://www.' + mobj
.group('url')
32 req
= compat_urllib_request
.Request(url
)
33 req
.add_header('Cookie', 'age_verified=1')
34 webpage
= self
._download
_webpage
(req
, video_id
)
36 video_title
= self
._html
_search
_regex
(r
'<h1>(.+?)<', webpage
, 'title')
37 video_url
= compat_urllib_parse_unquote(self
._html
_search
_regex
(r
'flashvars.video_url = \'([^
\']+)', webpage, 'video_url
'))
38 path = compat_urllib_parse_urlparse(video_url).path
39 extension = os.path.splitext(path)[1][1:]
40 format = path.split('/')[5].split('_
')[:2]
41 format = "-".join(format)
43 age_limit = self._rta_search(webpage)
52 'age_limit
': age_limit,