diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-01 04:45:27 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-01 04:45:27 +0200 |
commit | 01c5c24e6aa993b2060618e244f47a476725657d (patch) | |
tree | 836cb44ff85c4140f5eaed53583645faad2f7a70 /module/plugins/hoster/Keep2shareCC.py | |
parent | [CatShareNet] Fixed and improved (diff) | |
download | pyload-01c5c24e6aa993b2060618e244f47a476725657d.tar.xz |
[OneFichierCom] Fixed wait pattern + code optimizations
Diffstat (limited to 'module/plugins/hoster/Keep2shareCC.py')
-rw-r--r-- | module/plugins/hoster/Keep2shareCC.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index 78d6aaba7..f17faae46 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://k2s.cc/file/55fb73e1c00c5/random.bin import re @@ -22,13 +19,14 @@ class Keep2shareCC(SimpleHoster): __author_name__ = "stickell" __author_mail__ = "l.stickell@yahoo.it" + FILE_NAME_PATTERN = r'File: <span>(?P<N>.+)</span>' FILE_SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' LINK_PATTERN = r'To download this file with slow speed, use <a href="([^"]+)">this link</a>' WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' - ALREADY_DOWNLOADING_PATTERN = r'Free account does not allow to download more than one file at the same time' + MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time' RECAPTCHA_KEY = "6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb" @@ -59,7 +57,7 @@ class Keep2shareCC(SimpleHoster): self.wait(wait_time, reconnect=True) self.retry() - m = re.search(self.ALREADY_DOWNLOADING_PATTERN, self.html) + m = re.search(self.MULTIDL_ERROR, self.html) if m: # if someone is already downloading on our line, wait 30min and retry self.logDebug("Already downloading, waiting for 30 minutes") @@ -71,6 +69,7 @@ class Keep2shareCC(SimpleHoster): self.parseError("Unable to detect direct link") self.startDownload(m.group(1)) + def handleCaptcha(self): recaptcha = ReCaptcha(self) for _ in xrange(5): @@ -94,11 +93,13 @@ class Keep2shareCC(SimpleHoster): else: self.fail("All captcha attempts failed") + def startDownload(self, url): d = urljoin(self.base_url, url) self.logDebug("Direct Link: " + d) self.download(d, disposition=True) + def sanitize_url(self): header = self.load(self.pyfile.url, just_header=True) if 'location' in header: |