diff options
author | Stefano <l.stickell@yahoo.it> | 2013-06-25 13:14:57 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-06-25 13:14:57 +0200 |
commit | e8f6880229d03db2131cc4ed49b1a9c12394f3b0 (patch) | |
tree | f11158702b0ed00acb684850442d50dbf6ef4b25 /module | |
parent | UnrestrictLi: added ability to delete the download history (diff) | |
parent | StreamcloudEu Update to meet increased bot protection (diff) | |
download | pyload-e8f6880229d03db2131cc4ed49b1a9c12394f3b0.tar.xz |
Merge pull request #180 from seoester/streamcloud-update-148
StreamcloudEu fix. See:
http://forum.pyload.org/viewtopic.php?f=10&t=2738
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hoster/StreamcloudEu.py | 87 |
1 files changed, 85 insertions, 2 deletions
diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index 9e7c61ccc..35b9a0bd2 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo +from module.network.HTTPRequest import HTTPRequest +from time import sleep import re class StreamcloudEu(XFileSharingPro): @@ -15,7 +17,7 @@ class StreamcloudEu(XFileSharingPro): DIRECT_LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud.eu:?\d*/.*/video\.mp4)",' def setup(self): - super(XFileSharingPro, self).setup() + super(StreamcloudEu, self).setup() self.multiDL = True def getDownloadLink(self): @@ -23,6 +25,87 @@ class StreamcloudEu(XFileSharingPro): if found: return found.group(1) - return super(XFileSharingPro, self).getDownloadLink() + for i in range(5): + self.logDebug("Getting download link: #%d" % i) + data = self.getPostParameters() + httpRequest = HTTPRequest(options=self.req.options) + httpRequest.cj = self.req.cj + sleep(10) + self.html = httpRequest.load(self.pyfile.url, post = data, referer=False, cookies=True, decode = True) + self.header = httpRequest.header + + found = re.search("Location\s*:\s*(.*)", self.header, re.I) + if found: + break + + found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S) + if found: + break + + else: + if self.errmsg and 'captcha' in self.errmsg: + self.fail("No valid captcha code entered") + else: + self.fail("Download link not found") + + return found.group(1) + + def getPostParameters(self): + for i in range(3): + if not self.errmsg: self.checkErrors() + + if hasattr(self,"FORM_PATTERN"): + action, inputs = self.parseHtmlForm(self.FORM_PATTERN) + else: + action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) + + if not inputs: + action, inputs = self.parseHtmlForm('F1') + if not inputs: + if self.errmsg: + self.retry() + else: + self.parseError("Form not found") + + self.logDebug(self.HOSTER_NAME, inputs) + + if 'op' in inputs and inputs['op'] in ('download1', 'download2', 'download3'): + if "password" in inputs: + if self.passwords: + inputs['password'] = self.passwords.pop(0) + else: + self.fail("No or invalid passport") + + if not self.premium: + found = re.search(self.WAIT_PATTERN, self.html) + if found: + wait_time = int(found.group(1)) + 1 + self.setWait(wait_time, False) + else: + wait_time = 0 + + self.captcha = self.handleCaptcha(inputs) + + if wait_time: self.wait() + + self.errmsg = None + self.logDebug("getPostParameters {0}".format(i)) + return inputs + + else: + inputs['referer'] = self.pyfile.url + + if self.premium: + inputs['method_premium'] = "Premium Download" + if 'method_free' in inputs: del inputs['method_free'] + else: + inputs['method_free'] = "Free Download" + if 'method_premium' in inputs: del inputs['method_premium'] + + self.html = self.load(self.pyfile.url, post = inputs, ref = False) + self.errmsg = None + + else: self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN')) + getInfo = create_getInfo(StreamcloudEu) |