X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Feroprofile.py;h=0cbca90b061cf2358600146f37f6da5b61d71709;hb=2ddcd88129e633ead8c5faee6c930b66dddb1b32;hp=f6745fc52cd79eb36a6d786e9ffa971b196b85d3;hpb=461b00f34aabf6e75e0d53419919a8e6cc9cfd7a;p=youtube-dl diff --git a/youtube_dl/extractor/eroprofile.py b/youtube_dl/extractor/eroprofile.py index f6745fc52..0cbca90b0 100644 --- a/youtube_dl/extractor/eroprofile.py +++ b/youtube_dl/extractor/eroprofile.py @@ -3,51 +3,91 @@ from __future__ import unicode_literals import re from .common import InfoExtractor +from ..compat import compat_urllib_parse +from ..utils import ExtractorError + class EroProfileIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?eroprofile\.com/m/videos/view/(?P[^/]+)' - _TEST = { + _VALID_URL = r'https?://(?:www\.)?eroprofile\.com/m/videos/view/(?P[^/]+)' + _LOGIN_URL = 'http://www.eroprofile.com/auth/auth.php?' + _NETRC_MACHINE = 'eroprofile' + _TESTS = [{ 'url': 'http://www.eroprofile.com/m/videos/view/sexy-babe-softcore', 'md5': 'c26f351332edf23e1ea28ce9ec9de32f', 'info_dict': { 'id': '3733775', + 'display_id': 'sexy-babe-softcore', 'ext': 'm4v', - 'title': 'HD MOVIES - sexy babe softcore', - 'description': 'md5:831ee50526c333eb4f6c1e58d382c295', - 'categories': list, # NSFW + 'title': 'sexy babe softcore', 'thumbnail': 're:https?://.*\.jpg', 'age_limit': 18, } - } + }, { + 'url': 'http://www.eroprofile.com/m/videos/view/Try-It-On-Pee_cut_2-wmv-4shared-com-file-sharing-download-movie-file', + 'md5': '1baa9602ede46ce904c431f5418d8916', + 'info_dict': { + 'id': '1133519', + 'ext': 'm4v', + 'title': 'Try It On Pee_cut_2.wmv - 4shared.com - file sharing - download movie file', + 'thumbnail': 're:https?://.*\.jpg', + 'age_limit': 18, + }, + 'skip': 'Requires login', + }] - def _real_extract(self, url): - webpage = self._download_webpage(url, 'main') + def _login(self): + (username, password) = self._get_login_info() + if username is None: + return - video_id = self._html_search_regex(r'glbUpdViews\s*\(\'\d*\',\'(\d+)\'', webpage, 'id') + query = compat_urllib_parse.urlencode({ + 'username': username, + 'password': password, + 'url': 'http://www.eroprofile.com/', + }) + login_url = self._LOGIN_URL + query + login_page = self._download_webpage(login_url, None, False) - video_url = self._html_search_regex(r'([^<]+)\s*-\s*EroProfile', webpage, 'title') + self.report_login() + redirect_url = self._search_regex( + r']+?src="([^"]+)"', login_page, 'login redirect url') + self._download_webpage(redirect_url, None, False) - description = self._html_search_meta('description', webpage, 'description', fatal=False) + def _real_initialize(self): + self._login() - thumbnail = self._html_search_regex( - r'onclick="showVideoPlayer\(\)">([^<]+)', webpage, 'title') + thumbnail = self._search_regex( + r'onclick="showVideoPlayer\(\)">