# -*- coding: utf-8 -*- # # Test links: # http://ul.to/044yug9o # http://ul.to/gzfhd0xs import re from time import sleep from module.network.RequestFactory import getURL from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" __version__ = "0.79" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P\w+)' __description__ = """Uploaded.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] API_KEY = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=" #@NOTE: base64 encoded URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g')] INFO_PATTERN = r'(?P[^<]+)  \s*]*>(?P[^<]+)' OFFLINE_PATTERN = r'Error: 404' LINK_PREMIUM_PATTERN = r'
(\d+) seconds", self.html) if m: self.wait(m.group(1)) else: self.fail(_("File not downloadable for free users")) if "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")) 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() def handleFree(self, pyfile): self.html = self.load("http://uploaded.net/js/download.js", decode=True) recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() self.html = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], 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): if self.checkDownload({'limit-dl': self.DL_LIMIT_ERROR}): self.wait(3 * 60 * 60, True) self.retry() return super(UploadedTo, self).checkFile() getInfo = create_getInfo(UploadedTo)