diff options
Diffstat (limited to 'module/plugins/hoster/UploadedTo.py')
-rw-r--r-- | module/plugins/hoster/UploadedTo.py | 85 |
1 files changed, 23 insertions, 62 deletions
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 16966a23d..c90f2bb0f 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -2,16 +2,18 @@ import re import time +import urlparse -from module.network.RequestFactory import getURL -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.network.RequestFactory import getURL as get_url +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.89" + __version__ = "0.96" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -21,28 +23,30 @@ class UploadedTo(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - DISPOSITION = False - - API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" + CHECK_TRAFFIC = True URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g<ID>')] + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" + + OFFLINE_PATTERN = r'>Page not found' TEMP_OFFLINE_PATTERN = r'<title>uploaded\.net - Maintenance' + LINK_FREE_PATTERN = r"url:\s*'(.+?)'" LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' - WAIT_PATTERN = r'Current waiting period: <span>(\d+)' - DL_LIMIT_ERROR = r'You have reached the max. number of possible free downloads for this hour' + WAIT_PATTERN = r'Current waiting period: <span>(\d+)' + DL_LIMIT_PATTERN = r'You have reached the max. number of possible free downloads for this hour' @classmethod - def apiInfo(cls, url): - info = super(UploadedTo, cls).apiInfo(url) + def api_info(cls, url): + info = super(UploadedTo, cls).api_info(url) for _i in xrange(5): - html = getURL("http://uploaded.net/api/filemultiple", - get={"apikey": cls.API_KEY, 'id_0': re.match(cls.__pattern__, url).group('ID')}, - decode=True) + html = get_url("http://uploaded.net/api/filemultiple", + get={'apikey': cls.API_KEY, + 'id_0': re.match(cls.__pattern__, url).group('ID')}) if html != "can't find request": api = html.split(",", 4) @@ -58,42 +62,14 @@ class UploadedTo(SimpleHoster): def setup(self): - self.multiDL = self.resumeDownload = self.premium - self.chunkLimit = 1 # critical problems with more chunks - - - def checkErrors(self): - if 'var free_enabled = false;' in self.html: - self.logError(_("Free-download capacities exhausted")) - self.retry(24, 5 * 60) - - elif "limit-size" in self.html: - self.fail(_("File too big for free download")) - - elif "limit-slot" in self.html: # Temporary restriction so just wait a bit - self.wait(30 * 60, True) - self.retry() - - elif "limit-parallel" in self.html: - self.fail(_("Cannot download in parallel")) + self.multiDL = self.resume_download = self.premium + self.chunk_limit = 1 #: Critical problems with more chunks - elif "limit-dl" in self.html or self.DL_LIMIT_ERROR in self.html: # limit-dl - self.wait(3 * 60 * 60, True) - self.retry() - elif '"err":"captcha"' in self.html: - self.invalidCaptcha() - - else: - m = re.search(self.WAIT_PATTERN, self.html) - if m: - self.wait(m.group(1)) - - - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.load("http://uploaded.net/language/en", just_header=True) - self.html = self.load("http://uploaded.net/js/download.js", decode=True) + self.html = self.load("http://uploaded.net/js/download.js") recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() @@ -102,23 +78,8 @@ class UploadedTo(SimpleHoster): post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - if "type:'download'" in self.html: - self.correctCaptcha() - try: - self.link = re.search("url:'(.+?)'", self.html).group(1) - - except Exception: - pass - - self.checkErrors() - - - def checkFile(self, rules={}): - if self.checkDownload({'limit-dl': self.DL_LIMIT_ERROR}): - self.wait(3 * 60 * 60, True) - self.retry() - - return super(UploadedTo, self).checkFile(rules) + super(UploadedTo, self).handle_free(pyfile) + self.check_errors() getInfo = create_getInfo(UploadedTo) |