diff options
author | Stefano <l.stickell@yahoo.it> | 2013-09-03 14:49:34 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-09-07 20:32:31 +0200 |
commit | 08335c6506b5549fa8dbb8b3d905fe0d5f6ac71a (patch) | |
tree | 852cd6d60740cd0514eda8d509a1ad442e814248 /pyload/plugins | |
parent | Megashares: fix suggested in #234 (diff) | |
download | pyload-08335c6506b5549fa8dbb8b3d905fe0d5f6ac71a.tar.xz |
BitshareCom: fixes
see #227
(cherry picked from commit cfdfa4771cd1037363c9937d6bf86f3ab6580b98)
Diffstat (limited to 'pyload/plugins')
-rw-r--r-- | pyload/plugins/hoster/BitshareCom.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/pyload/plugins/hoster/BitshareCom.py b/pyload/plugins/hoster/BitshareCom.py index 82c2fe9cb..2b3f7777f 100644 --- a/pyload/plugins/hoster/BitshareCom.py +++ b/pyload/plugins/hoster/BitshareCom.py @@ -11,20 +11,20 @@ class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" __pattern__ = r"http://(www\.)?bitshare\.com/(files/(?P<id1>[a-zA-Z0-9]+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>[a-zA-Z0-9]+))" - __version__ = "0.48" + __version__ = "0.49" __description__ = """Bitshare.Com File Download Hoster""" __author_name__ = ("paulking", "fragonib") __author_mail__ = (None, "fragonib[AT]yahoo[DOT]es") HOSTER_DOMAIN = "bitshare.com" FILE_OFFLINE_PATTERN = r'(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)' - FILE_NAME_PATTERN = r'Download:</td>\s*<td><input type="text" value="http://bitshare\.com/files/\w+/(?P<N>[^"]+)\.html"' - FILE_SIZE_PATTERN = r'- (?P<S>[\d.]+) (?P<U>\w+)</h1>' + FILE_INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.]+) (?P<U>\w+)</h1>' FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) " TRAFFIC_USED_UP = r"Your Traffic is used up for today. Upgrade to premium to continue!" def setup(self): + self.req.cj.setCookie(self.HOSTER_DOMAIN, "language_selection", "EN") self.multiDL = self.premium self.chunkLimit = 1 @@ -40,15 +40,14 @@ class BitshareCom(SimpleHoster): self.logDebug("File id is [%s]" % self.file_id) # Load main page - self.req.cj.setCookie(self.HOSTER_DOMAIN, "language_selection", "EN") self.html = self.load(self.pyfile.url, ref=False, decode=True) # Check offline - if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: + if re.search(self.FILE_OFFLINE_PATTERN, self.html): self.offline() # Check Traffic used up - if re.search(BitshareCom.TRAFFIC_USED_UP, self.html) is not None: + if re.search(self.TRAFFIC_USED_UP, self.html): self.logInfo("Your Traffic is used up for today. Wait 1800 seconds or reconnect!") self.logDebug("Waiting %d seconds." % 1800) self.setWait(1800, True) @@ -57,14 +56,14 @@ class BitshareCom(SimpleHoster): self.retry() # File name - m = re.search(BitshareCom.__pattern__, self.pyfile.url) - name1 = m.group('name') if m is not None else None - m = re.search(BitshareCom.FILE_INFO_PATTERN, self.html) - name2 = m.group('name') if m is not None else None + m = re.search(self.__pattern__, self.pyfile.url) + name1 = m.group('name') if m else None + m = re.search(self.FILE_INFO_PATTERN, self.html) + name2 = m.group('N') if m else None self.pyfile.name = max(name1, name2) # Ajax file id - self.ajaxid = re.search(BitshareCom.FILE_AJAXID_PATTERN, self.html).group(1) + self.ajaxid = re.search(self.FILE_AJAXID_PATTERN, self.html).group(1) self.logDebug("File ajax id is [%s]" % self.ajaxid) # This may either download our file or forward us to an error page @@ -104,7 +103,7 @@ class BitshareCom(SimpleHoster): # Resolve captcha if captcha == 1: self.logDebug("File is captcha protected") - id = re.search(BitshareCom.CAPTCHA_KEY_PATTERN, self.html).group(1) + id = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) # Try up to 3 times for i in range(3): self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i + 1)) |