1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..compat
import compat_urllib_parse_urlencode
13 class EroProfileIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?eroprofile\.com/m/videos/view/(?P<id>[^/]+)'
15 _LOGIN_URL
= 'http://www.eroprofile.com/auth/auth.php?'
16 _NETRC_MACHINE
= 'eroprofile'
18 'url': 'http://www.eroprofile.com/m/videos/view/sexy-babe-softcore',
19 'md5': 'c26f351332edf23e1ea28ce9ec9de32f',
22 'display_id': 'sexy-babe-softcore',
24 'title': 'sexy babe softcore',
25 'thumbnail': r
're:https?://.*\.jpg',
28 'skip': 'Video not found',
30 'url': 'http://www.eroprofile.com/m/videos/view/Try-It-On-Pee_cut_2-wmv-4shared-com-file-sharing-download-movie-file',
31 'md5': '1baa9602ede46ce904c431f5418d8916',
35 'title': 'Try It On Pee_cut_2.wmv - 4shared.com - file sharing - download movie file',
36 'thumbnail': r
're:https?://.*\.jpg',
39 'skip': 'Requires login',
43 (username
, password
) = self
._get
_login
_info
()
47 query
= compat_urllib_parse_urlencode({
50 'url': 'http://www.eroprofile.com/',
52 login_url
= self
._LOGIN
_URL
+ query
53 login_page
= self
._download
_webpage
(login_url
, None, False)
55 m
= re
.search(r
'Your username or password was incorrect\.', login_page
)
58 'Wrong username and/or password.', expected
=True)
61 redirect_url
= self
._search
_regex
(
62 r
'<script[^>]+?src="([^"]+)"', login_page
, 'login redirect url')
63 self
._download
_webpage
(redirect_url
, None, False)
65 def _real_initialize(self
):
68 def _real_extract(self
, url
):
69 display_id
= self
._match
_id
(url
)
71 webpage
= self
._download
_webpage
(url
, display_id
)
73 m
= re
.search(r
'You must be logged in to view this video\.', webpage
)
75 self
.raise_login_required('This video requires login')
77 video_id
= self
._search
_regex
(
78 [r
"glbUpdViews\s*\('\d*','(\d+)'", r
'p/report/video/(\d+)'],
79 webpage
, 'video id', default
=None)
81 title
= self
._html
_search
_regex
(
82 (r
'Title:</th><td>([^<]+)</td>', r
'<h1[^>]*>(.+?)</h1>'),
85 info
= self
._parse
_html
5_media
_entries
(url
, webpage
, video_id
)[0]
87 return merge_dicts(info
, {
89 'display_id': display_id
,
95 class EroProfileAlbumIE(InfoExtractor
):
96 _VALID_URL
= r
'https?://(?:www\.)?eroprofile\.com/m/videos/album/(?P<id>[^/]+)'
97 IE_NAME
= 'EroProfile:album'
100 'url': 'https://www.eroprofile.com/m/videos/album/BBW-2-893',
105 'playlist_mincount': 486,
109 def _extract_from_page(self
, page
):
110 for url
in re
.findall(r
'href=".*?(/m/videos/view/[^"]+)"', page
):
111 yield self
.url_result(f
'https://www.eroprofile.com{url}', EroProfileIE
.ie_key())
113 def _entries(self
, playlist_id
, first_page
):
114 yield from self
._extract
_from
_page
(first_page
)
116 page_urls
= re
.findall(rf
'href=".*?(/m/videos/album/{playlist_id}\?pnum=(\d+))"', first_page
)
117 max_page
= max(int(n
) for _
, n
in page_urls
)
119 for n
in range(2, max_page
+ 1):
120 url
= f
'https://www.eroprofile.com/m/videos/album/{playlist_id}?pnum={n}'
121 yield from self
._extract
_from
_page
(
122 self
._download
_webpage
(url
, playlist_id
,
123 note
=f
'Downloading playlist page {int(n) - 1}'))
125 def _real_extract(self
, url
):
126 playlist_id
= self
._match
_id
(url
)
127 first_page
= self
._download
_webpage
(url
, playlist_id
, note
='Downloading playlist')
128 playlist_title
= self
._search
_regex
(
129 r
'<title>Album: (.*) - EroProfile</title>', first_page
, 'playlist_title')
131 return self
.playlist_result(self
._entries
(playlist_id
, first_page
), playlist_id
, playlist_title
)