diff options
Diffstat (limited to 'module/plugins/hoster/BitshareCom.py')
-rw-r--r-- | module/plugins/hoster/BitshareCom.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index d4b0668c0..3c84ce5da 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -4,28 +4,31 @@ from __future__ import with_statement import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" + __version__ = "0.50" + __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.49" + __description__ = """Bitshare.com hoster plugin""" __author_name__ = ("Paul King", "fragonib") __author_mail__ = ("", "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_INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.]+) (?P<U>\w+)</h1>' + 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_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!" + 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.req.cj.setCookie(".bitshare.com", "language_selection", "EN") self.multiDL = self.premium self.chunkLimit = 1 @@ -44,13 +47,12 @@ class BitshareCom(SimpleHoster): self.html = self.load(pyfile.url, ref=False, decode=True) # Check offline - if re.search(self.FILE_OFFLINE_PATTERN, self.html): + if re.search(self.OFFLINE_PATTERN, self.html): self.offline() # Check Traffic used up 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.logInfo("Your Traffic is used up for today") self.wait(30 * 60, True) self.retry() @@ -70,6 +72,12 @@ class BitshareCom(SimpleHoster): self.logDebug("Downloading file with url [%s]" % url) self.download(url) + check = self.checkDownload({"404": ">404 Not Found<", "Error": ">Error occured<"}) + if check == "404": + self.retry(3, 60, 'Error 404') + elif check == "error": + self.retry(5, 5 * 60, "Bitshare host : Error occured") + def getDownloadUrl(self): # Return location if direct download is active if self.premium: |