diff options
Diffstat (limited to 'pyload/plugin/hoster')
-rw-r--r-- | pyload/plugin/hoster/FilerNet.py | 6 | ||||
-rw-r--r-- | pyload/plugin/hoster/FreakshareCom.py | 2 | ||||
-rw-r--r-- | pyload/plugin/hoster/GigapetaCom.py | 2 | ||||
-rw-r--r-- | pyload/plugin/hoster/HostujeNet.py | 46 | ||||
-rw-r--r-- | pyload/plugin/hoster/MegasharesCom.py | 2 | ||||
-rw-r--r-- | pyload/plugin/hoster/QuickshareCz.py | 2 | ||||
-rw-r--r-- | pyload/plugin/hoster/UploadedTo.py | 4 | ||||
-rw-r--r-- | pyload/plugin/hoster/XdadevelopersCom.py | 3 | ||||
-rw-r--r-- | pyload/plugin/hoster/Xdcc.py | 2 | ||||
-rw-r--r-- | pyload/plugin/hoster/YadiSk.py | 81 | ||||
-rw-r--r-- | pyload/plugin/hoster/ZippyshareCom.py | 4 |
11 files changed, 101 insertions, 53 deletions
diff --git a/pyload/plugin/hoster/FilerNet.py b/pyload/plugin/hoster/FilerNet.py index f9b38e8cb..86a5809da 100644 --- a/pyload/plugin/hoster/FilerNet.py +++ b/pyload/plugin/hoster/FilerNet.py @@ -48,13 +48,9 @@ class FilerNet(SimpleHoster): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() - #@NOTE: Work-around for v0.4.9 just_header issue - #@TODO: Check for v0.4.10 - self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, - 'hash': inputs['hash']}) - self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) + 'hash': inputs['hash']}, follow_location=False) if 'location' in self.req.http.header.lower(): self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) diff --git a/pyload/plugin/hoster/FreakshareCom.py b/pyload/plugin/hoster/FreakshareCom.py index c5315cdc8..64d8f8308 100644 --- a/pyload/plugin/hoster/FreakshareCom.py +++ b/pyload/plugin/hoster/FreakshareCom.py @@ -130,7 +130,7 @@ class FreakshareCom(Hoster): if m: units = float(m.group(1).replace(",", "")) pow = {'KB': 1, 'MB': 2, 'GB': 3}[m.group(2)] - size = int(units * 1024 ** pow) + size = int(units * (2 ** 20) ** pow) return size diff --git a/pyload/plugin/hoster/GigapetaCom.py b/pyload/plugin/hoster/GigapetaCom.py index adbdc2396..c524a0a7c 100644 --- a/pyload/plugin/hoster/GigapetaCom.py +++ b/pyload/plugin/hoster/GigapetaCom.py @@ -43,7 +43,7 @@ class GigapetaCom(SimpleHoster): m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m: - self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + self.link = m.group(1) break elif "Entered figures don`t coincide with the picture" in self.html: self.invalidCaptcha() diff --git a/pyload/plugin/hoster/HostujeNet.py b/pyload/plugin/hoster/HostujeNet.py new file mode 100644 index 000000000..4dd5bb1c3 --- /dev/null +++ b/pyload/plugin/hoster/HostujeNet.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class HostujeNet(SimpleHoster): + __name__ = "HostujeNet" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?hostuje\.net/\w+' + + __description__ = """Hostuje.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + NAME_PATTERN = r'<input type="hidden" name="name" value="(?P<N>.+?)">' + SIZE_PATTERN = r'<b>Rozmiar:</b> (?P<S>[\d.,]+) (?P<U>[\w^_]+)<br>' + OFFLINE_PATTERN = ur'Podany plik nie został odnaleziony\.\.\.' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + m = re.search(r'<script src="([\w^_]+.php)"></script>', self.html) + if m: + jscript = self.load("http://hostuje.net/" + m.group(1)) + m = re.search(r"\('(\w+\.php\?i=\w+)'\);", jscript) + if m: + self.load("http://hostuje.net/" + m.group(1)) + else: + self.error(_("unexpected javascript format")) + else: + self.error(_("script not found")) + + action, inputs = self.parseHtmlForm(pyfile.url.replace(".", "\.").replace( "?", "\?")) + if not action: + self.error(_("form not found")) + + self.download(action, post=inputs) diff --git a/pyload/plugin/hoster/MegasharesCom.py b/pyload/plugin/hoster/MegasharesCom.py index 184be2fd6..ac7a81313 100644 --- a/pyload/plugin/hoster/MegasharesCom.py +++ b/pyload/plugin/hoster/MegasharesCom.py @@ -89,7 +89,7 @@ class MegasharesCom(SimpleHoster): self.fail(_("Passport not found")) self.logInfo(_("Download passport: %s") % m.group(1)) - data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] + data_left = float(m.group(2)) * (2 ** 20) ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] self.logInfo(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: diff --git a/pyload/plugin/hoster/QuickshareCz.py b/pyload/plugin/hoster/QuickshareCz.py index 6d6f21c71..3dd11f04a 100644 --- a/pyload/plugin/hoster/QuickshareCz.py +++ b/pyload/plugin/hoster/QuickshareCz.py @@ -65,7 +65,7 @@ class QuickshareCz(SimpleHoster): if m is None: self.fail(_("File not found")) - self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + self.link = m.group(1) self.logDebug("FREE URL2:" + self.link) # check errors diff --git a/pyload/plugin/hoster/UploadedTo.py b/pyload/plugin/hoster/UploadedTo.py index 7031d0ab2..487c01576 100644 --- a/pyload/plugin/hoster/UploadedTo.py +++ b/pyload/plugin/hoster/UploadedTo.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class UploadedTo(SimpleHoster): __name = "UploadedTo" __type = "hoster" - __version = "0.85" + __version = "0.86" __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,6 +21,8 @@ class UploadedTo(SimpleHoster): __authors = [("Walter Purcaro", "vuolter@gmail.com")] + DISPOSITION = False + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" URL_REPLACEMENTS = [(__pattern + ".*", r'http://uploaded.net/file/\g<ID>')] diff --git a/pyload/plugin/hoster/XdadevelopersCom.py b/pyload/plugin/hoster/XdadevelopersCom.py index 488d29c44..0fe9197aa 100644 --- a/pyload/plugin/hoster/XdadevelopersCom.py +++ b/pyload/plugin/hoster/XdadevelopersCom.py @@ -33,4 +33,5 @@ class XdadevelopersCom(SimpleHoster): def handleFree(self, pyfile): - self.link = pyfile.url + "&task=get" #@TODO: Revert to `get={'task': "get"}` in 0.4.10 + self.download(pyfile.url, + get={'task': "get"}) diff --git a/pyload/plugin/hoster/Xdcc.py b/pyload/plugin/hoster/Xdcc.py index 587c73157..f2b5d0b8f 100644 --- a/pyload/plugin/hoster/Xdcc.py +++ b/pyload/plugin/hoster/Xdcc.py @@ -191,7 +191,7 @@ class Xdcc(Hoster): self.pyfile.name = packname - download_folder = self.config['general']['download_folder'] + download_folder = self.config.get("general", "download_folder") filename = fs_join(download_folder, packname) self.logInfo(_("Downloading %s from %s:%d") % (packname, ip, port)) diff --git a/pyload/plugin/hoster/YadiSk.py b/pyload/plugin/hoster/YadiSk.py index 528d6bc80..f68039e2e 100644 --- a/pyload/plugin/hoster/YadiSk.py +++ b/pyload/plugin/hoster/YadiSk.py @@ -10,7 +10,7 @@ from pyload.utils import json_loads class YadiSk(SimpleHoster): __name = "YadiSk" __type = "hoster" - __version = "0.03" + __version = "0.04" __pattern = r'https?://yadi\.sk/d/\w+' @@ -22,6 +22,42 @@ class YadiSk(SimpleHoster): OFFLINE_PATTERN = r'Nothing found' + @classmethod + def getInfo(cls, url="", html=""): + info = super(YadiSk, cls).getInfo(url, html) + + if html: + if 'idclient' not in info: + info['idclient'] = "" + for _i in xrange(32): + info ['idclient'] += random.choice('0123456abcdef') + + m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', html) + if m: + api_data = json_loads(m.group(1)) + try: + for sect in api_data: + if 'model' in sect: + if sect['model'] == "config": + info['version'] = sect['data']['version'] + info['sk'] = sect['data']['sk'] + + elif sect['model'] == "resource": + info['id'] = sect['data']['id'] + info['size'] = sect['data']['meta']['size'] + info['name'] = sect['data']['name'] + + except Exception, e: + info['status'] = 8 + info['error'] = _("Unexpected server response: %s") % e.message + + else: + info['status'] = 8 + info['error'] = _("could not find required json data") + + return info + + def setup(self): self.resumeDownload = False self.multiDL = False @@ -29,51 +65,18 @@ class YadiSk(SimpleHoster): def handleFree(self, pyfile): - m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', self.html) - if m is None: - self.error(_("could not find required json data")) - - res = json_loads(m.group(1)) - - yadisk_ver = None - yadisk_sk = None - yadisk_id = None - yadisk_size = None - yadisk_name = None - - try: #@TODO: Copy to apiInfo - for sect in res: - if 'model' in sect: - if sect['model'] == "config": - yadisk_ver = sect['data']['version'] - yadisk_sk = sect['data']['sk'] - - elif sect['model'] == "resource": - yadisk_id = sect['data']['id'] - yadisk_size = sect['data']['meta']['size'] - yadisk_name = sect['data']['name'] - - except Exception, e: - self.fail(_("Unexpected server response"), e) - - if None in (yadisk_id, yadisk_sk, yadisk_id, yadisk_size, yadisk_name): + if any(True for _k in ['id', 'sk', 'version', 'idclient'] if _k not in self.info): self.error(_("Missing JSON data")) - self.pyfile.size = yadisk_size - self.pyfile.name = yadisk_name - - yadisk_idclient = "" - for _i in range(32): - yadisk_idclient += random.choice('0123456abcdef') try: self.html = self.load("https://yadi.sk/models/", get={'_m': "do-get-resource-url"}, - post={'idClient': yadisk_idclient, - 'version' : yadisk_ver, + post={'idClient': self.info['idclient'], + 'version' : self.info['version'], '_model.0': "do-get-resource-url", - 'sk' : yadisk_sk, - 'id.0' : yadisk_id}) + 'sk' : self.info['sk'], + 'id.0' : self.info['id']}) self.link = json_loads(self.html)['models'][0]['data']['file'] diff --git a/pyload/plugin/hoster/ZippyshareCom.py b/pyload/plugin/hoster/ZippyshareCom.py index 91a636f0a..a062df458 100644 --- a/pyload/plugin/hoster/ZippyshareCom.py +++ b/pyload/plugin/hoster/ZippyshareCom.py @@ -67,13 +67,13 @@ class ZippyshareCom(SimpleHoster): def replElementById(element): - id = element.group(1) # id might be either 'x' (a real id) or x (a variable) + id = element.group(1) #: id might be either 'x' (a real id) or x (a variable) attr = element.group(4) # attr might be None varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) realid = id.strip('"\'') - if id != realid: #id is not a variable, so look for realid.attr in the html + if id != realid: #: id is not a variable, so look for realid.attr in the html initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) initValue = '"%s"' % initValues[-1] if initValues else 'null' initScripts.add('%s = %s;' % (varName, initValue)) |