diff options
Diffstat (limited to 'module/plugins/hoster/UploadedTo.py')
-rw-r--r-- | module/plugins/hoster/UploadedTo.py | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 150b69534..995b766b4 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -1,8 +1,4 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://ul.to/044yug9o -# http://ul.to/gzfhd0xs import re @@ -16,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.79" + __version__ = "0.81" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' @@ -25,15 +21,13 @@ class UploadedTo(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - API_KEY = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=" #@NOTE: base64 encoded + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g<ID>')] - INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a> \s*<small[^>]*>(?P<S>[^<]+)</small>' - OFFLINE_PATTERN = r'<small class="cL">Error: 404' - 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' @@ -42,18 +36,16 @@ class UploadedTo(SimpleHoster): info = super(UploadedTo, cls).apiInfo(url) for _i in xrange(5): - api = getURL("http://uploaded.net/api/filemultiple", - post={"apikey": cls.API_KEY.decode('base64'), 'id_0': re.match(cls.__pattern__, url).group('ID')}, + html = getURL("http://uploaded.net/api/filemultiple", + get={"apikey": cls.API_KEY, 'id_0': re.match(cls.__pattern__, url).group('ID')}, decode=True) - if api != "can't find request": - api = api.splitlines()[0].split(",", 4) - - if api[0] == "online": - info.update({'name': api[4], 'size': api[2], 'status': 2}) - elif api[0] == "offline": + if html != "can't find request": + api = html.split(",", 4) + if api[0] == "offline": info['status'] = 1 - + else: + info.update({'name': api[4], 'size': api[2], 'status': 2}) break else: sleep(3) @@ -72,14 +64,7 @@ class UploadedTo(SimpleHoster): self.logError(_("Free-download capacities exhausted")) self.retry(24, 5 * 60) - if not self.premium: - m = re.search(r"Current waiting period: <span>(\d+)</span> 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: + 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 @@ -96,6 +81,11 @@ class UploadedTo(SimpleHoster): 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): self.html = self.load("http://uploaded.net/js/download.js", decode=True) |