From c0a976b02b13fcda9d20372b4562a1fdfae61f82 Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 30 Jun 2014 13:06:54 +0200 Subject: [Bitshare] Fixed #663 --- module/plugins/hoster/BitshareCom.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index d4b0668c0..c1a0d50f8 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -12,7 +12,7 @@ class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P[a-zA-Z0-9]+)(/(?P.*?)\.html)?|\?f=(?P[a-zA-Z0-9]+))' - __version__ = "0.49" + __version__ = "0.50" __description__ = """Bitshare.com hoster plugin""" __author_name__ = ("Paul King", "fragonib") __author_mail__ = ("", "fragonib[AT]yahoo[DOT]es") @@ -70,6 +70,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: -- cgit v1.2.3 From 93592862b520a862c01f80c019e5c4bc43746c19 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 5 Jul 2014 16:54:20 +0200 Subject: [SimpleHoster] Better inline docs + changed "FILE_OFFLINE_PATTERN" to "OFFLINE_PATTERN" --- module/plugins/hoster/BitshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index c1a0d50f8..3b0fc5137 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -18,7 +18,7 @@ class BitshareCom(SimpleHoster): __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)' + 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.+) - (?P[\d.]+) (?P\w+)' FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) " @@ -44,7 +44,7 @@ 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 -- cgit v1.2.3 From 0072668fd976f9ce4dbaac7e807791f21cbe07ed Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 6 Jul 2014 18:57:55 +0200 Subject: Compute wait time using secondsToMidnight --- module/plugins/hoster/BitshareCom.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 3b0fc5137..89546aae5 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -49,8 +49,7 @@ class BitshareCom(SimpleHoster): # 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() -- cgit v1.2.3 From 04038a2cf0c4c2d9cc9a0c8e8bf9beb6426afae8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 10 Jul 2014 03:02:26 +0200 Subject: Use parseError instead PluginParseError + unified all download pattern attributes as LINK_PATTERN + removed some old patterns (not used anymore) + other code cosmetics --- module/plugins/hoster/BitshareCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 89546aae5..e8e0f9203 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -17,15 +17,15 @@ class BitshareCom(SimpleHoster): __author_name__ = ("Paul King", "fragonib") __author_mail__ = ("", "fragonib[AT]yahoo[DOT]es") - HOSTER_DOMAIN = "bitshare.com" + HOSTER_NAME = "bitshare.com" 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.+) - (?P[\d.]+) (?P\w+)' 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(self.HOSTER_NAME, "language_selection", "EN") self.multiDL = self.premium self.chunkLimit = 1 -- cgit v1.2.3 From a9f81c043c62abcb3ce38971237693736833fdbe Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:28:23 +0200 Subject: Fix hosters SH_COOKIES syntax --- module/plugins/hoster/BitshareCom.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index e8e0f9203..a6ed51d94 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" + __version__ = "0.50" __type__ = "hoster" + __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P[a-zA-Z0-9]+)(/(?P.*?)\.html)?|\?f=(?P[a-zA-Z0-9]+))' - __version__ = "0.50" + __description__ = """Bitshare.com hoster plugin""" __author_name__ = ("Paul King", "fragonib") __author_mail__ = ("", "fragonib[AT]yahoo[DOT]es") - HOSTER_NAME = "bitshare.com" - 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.+) - (?P[\d.]+) (?P\w+)' + 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!' + def setup(self): - self.req.cj.setCookie(self.HOSTER_NAME, "language_selection", "EN") + self.req.cj.setCookie(".bitshare.com", "language_selection", "EN") self.multiDL = self.premium self.chunkLimit = 1 -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/BitshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index a6ed51d94..3c84ce5da 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -10,8 +10,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" - __version__ = "0.50" __type__ = "hoster" + __version__ = "0.50" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P[a-zA-Z0-9]+)(/(?P.*?)\.html)?|\?f=(?P[a-zA-Z0-9]+))' -- cgit v1.2.3 From 23ae563604dca1dae262fbc598154b99b2f1eae8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 3 Oct 2014 09:06:05 +0200 Subject: Update plugins after CaptchaService and XFileSharingPro changes --- module/plugins/hoster/BitshareCom.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 3c84ce5da..d7143952b 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -23,7 +23,6 @@ class BitshareCom(SimpleHoster): 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!' @@ -108,12 +107,15 @@ class BitshareCom(SimpleHoster): # Resolve captcha if captcha == 1: self.logDebug("File is captcha protected") - id = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha captcha key not found") + # Try up to 3 times for i in xrange(3): - self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i + 1)) - recaptcha = ReCaptcha(self) - challenge, code = recaptcha.challenge(id) + self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (captcha_key, i + 1)) + challenge, code = recaptcha.challenge(captcha_key) response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "validateCaptcha", "ajaxid": self.ajaxid, "recaptcha_challenge_field": challenge, "recaptcha_response_field": code}) -- cgit v1.2.3 From df10dce103716acc293f51572650b3dbb7264bf2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 5 Oct 2014 01:55:44 +0200 Subject: Spare code fixes about COOKIES --- module/plugins/hoster/BitshareCom.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index d7143952b..86bc22860 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -22,15 +22,17 @@ class BitshareCom(SimpleHoster): FILE_INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.]+) (?P\w+)' 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)' + COOKIES = [(".bitshare.com", "language_selection", "EN")] + FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!' def setup(self): - self.req.cj.setCookie(".bitshare.com", "language_selection", "EN") self.multiDL = self.premium self.chunkLimit = 1 + def process(self, pyfile): if self.premium: self.account.relogin(self.user) @@ -77,6 +79,7 @@ class BitshareCom(SimpleHoster): 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: @@ -131,6 +134,7 @@ class BitshareCom(SimpleHoster): return url + def handleErrors(self, response, separator): self.logDebug("Checking response [%s]" % response) if "ERROR:Session timed out" in response: @@ -139,6 +143,7 @@ class BitshareCom(SimpleHoster): msg = response.split(separator)[-1] self.fail(msg) + def handleCaptchaErrors(self, response): self.logDebug("Result of captcha resolving [%s]" % response) if "SUCCESS" in response: -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/hoster/BitshareCom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 86bc22860..a9d9e78cb 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -16,8 +16,9 @@ class BitshareCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P[a-zA-Z0-9]+)(/(?P.*?)\.html)?|\?f=(?P[a-zA-Z0-9]+))' __description__ = """Bitshare.com hoster plugin""" - __author_name__ = ("Paul King", "fragonib") - __author_mail__ = ("", "fragonib[AT]yahoo[DOT]es") + __authors__ = [("Paul King", None), + ("fragonib", "fragonib[AT]yahoo[DOT]es")] + FILE_INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.]+) (?P\w+)' 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)' -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/hoster/BitshareCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index a9d9e78cb..2a0b0fa9b 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -16,6 +16,7 @@ class BitshareCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P[a-zA-Z0-9]+)(/(?P.*?)\.html)?|\?f=(?P[a-zA-Z0-9]+))' __description__ = """Bitshare.com hoster plugin""" + __license__ = "GPLv3" __authors__ = [("Paul King", None), ("fragonib", "fragonib[AT]yahoo[DOT]es")] -- cgit v1.2.3 From f76e5c2336718dca9da8033ba22cd83c72c7b3b3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:14:28 +0200 Subject: Pattern update 1 --- module/plugins/hoster/BitshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 2a0b0fa9b..1e98a1349 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -13,7 +13,7 @@ class BitshareCom(SimpleHoster): __type__ = "hoster" __version__ = "0.50" - __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P[a-zA-Z0-9]+)(/(?P.*?)\.html)?|\?f=(?P[a-zA-Z0-9]+))' + __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P\w+)(/(?P.*?)\.html)?|\?f=(?P\w+))' __description__ = """Bitshare.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From c5d1a4fd8943877c6d2eb3843e0de725dba5191e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:09:53 +0200 Subject: Pattern update 2 --- module/plugins/hoster/BitshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 1e98a1349..1b70b1710 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -21,7 +21,7 @@ class BitshareCom(SimpleHoster): ("fragonib", "fragonib[AT]yahoo[DOT]es")] - FILE_INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.]+) (?P\w+)' + FILE_INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.,]+) (?P\w+)' 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)' COOKIES = [(".bitshare.com", "language_selection", "EN")] -- cgit v1.2.3 From 388a2f6478d42e423f1f8442d8539983f3762f22 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 14 Oct 2014 13:38:49 +0200 Subject: Improve unit detection in size pattern --- module/plugins/hoster/BitshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 1b70b1710..8fd8892be 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -21,7 +21,7 @@ class BitshareCom(SimpleHoster): ("fragonib", "fragonib[AT]yahoo[DOT]es")] - FILE_INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.,]+) (?P\w+)' + FILE_INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.,]+) (?P[\w^_]+)' 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)' COOKIES = [(".bitshare.com", "language_selection", "EN")] -- cgit v1.2.3 From 2ae91b81a2f12a1c9b1f78524df78a2b3f1ef494 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Oct 2014 14:52:42 +0200 Subject: Update hosters to self.error --- module/plugins/hoster/BitshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 8fd8892be..9d2a23625 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.50" + __version__ = "0.51" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P\w+)(/(?P.*?)\.html)?|\?f=(?P\w+))' @@ -115,7 +115,7 @@ class BitshareCom(SimpleHoster): recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key is None: - self.parseError("ReCaptcha captcha key not found") + self.error("ReCaptcha captcha key not found") # Try up to 3 times for i in xrange(3): -- cgit v1.2.3 From 7b67f68c1636014fe02286da71bdc6c13dc3eeee Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Oct 2014 00:50:23 +0200 Subject: Simplify captcha challenge calls --- module/plugins/hoster/BitshareCom.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 9d2a23625..fe2ff0be6 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -113,14 +113,10 @@ class BitshareCom(SimpleHoster): if captcha == 1: self.logDebug("File is captcha protected") recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.error("ReCaptcha captcha key not found") # Try up to 3 times for i in xrange(3): - self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (captcha_key, i + 1)) - challenge, code = recaptcha.challenge(captcha_key) + challenge, code = recaptcha.challenge() response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "validateCaptcha", "ajaxid": self.ajaxid, "recaptcha_challenge_field": challenge, "recaptcha_response_field": code}) -- cgit v1.2.3 From 4da90891eb2544ac15a7d512aba8cb357f68ee5f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 01:11:29 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/BitshareCom.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index fe2ff0be6..a7edf60f3 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -72,7 +72,6 @@ class BitshareCom(SimpleHoster): # This may either download our file or forward us to an error page url = self.getDownloadUrl() - self.logDebug("Downloading file with url [%s]" % url) self.download(url) check = self.checkDownload({"404": ">404 Not Found<", "Error": ">Error occured<"}) @@ -149,7 +148,7 @@ class BitshareCom(SimpleHoster): return True elif "ERROR:SESSION ERROR" in response: self.retry() - self.logDebug("Wrong captcha") + self.invalidCaptcha() -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- module/plugins/hoster/BitshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index a7edf60f3..4cbc04755 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -55,7 +55,7 @@ class BitshareCom(SimpleHoster): # Check Traffic used up if re.search(self.TRAFFIC_USED_UP, self.html): - self.logInfo("Your Traffic is used up for today") + self.logInfo(_("Your Traffic is used up for today")) self.wait(30 * 60, True) self.retry() -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/hoster/BitshareCom.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 4cbc04755..81af82a4c 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -9,16 +9,16 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): - __name__ = "BitshareCom" - __type__ = "hoster" + __name__ = "BitshareCom" + __type__ = "hoster" __version__ = "0.51" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P\w+)(/(?P.*?)\.html)?|\?f=(?P\w+))' __description__ = """Bitshare.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("Paul King", None), - ("fragonib", "fragonib[AT]yahoo[DOT]es")] + __license__ = "GPLv3" + __authors__ = [("Paul King", None), + ("fragonib", "fragonib[AT]yahoo[DOT]es")] FILE_INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.,]+) (?P[\w^_]+)' -- cgit v1.2.3 From 772e47ef806d18fd209e910be0535bce7c07dc7b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 2 Nov 2014 22:47:07 +0100 Subject: Update all other plugins --- module/plugins/hoster/BitshareCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 81af82a4c..b2fe2c48a 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -21,12 +21,12 @@ class BitshareCom(SimpleHoster): ("fragonib", "fragonib[AT]yahoo[DOT]es")] - FILE_INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.,]+) (?P[\w^_]+)' + INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.,]+) (?P[\w^_]+)' 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)' COOKIES = [(".bitshare.com", "language_selection", "EN")] - FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' + AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!' @@ -62,12 +62,12 @@ class BitshareCom(SimpleHoster): # File name m = re.match(self.__pattern__, pyfile.url) name1 = m.group('name') if m else None - m = re.search(self.FILE_INFO_PATTERN, self.html) + m = re.search(self.INFO_PATTERN, self.html) name2 = m.group('N') if m else None pyfile.name = max(name1, name2) # Ajax file id - self.ajaxid = re.search(self.FILE_AJAXID_PATTERN, self.html).group(1) + self.ajaxid = re.search(self.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 -- cgit v1.2.3 From c9e31d875d32de31e54959b82bc35eff2b3e0f3f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 10 Nov 2014 00:19:51 +0100 Subject: Code cosmetics --- module/plugins/hoster/BitshareCom.py | 38 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index b2fe2c48a..35aff7c1e 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -90,10 +90,10 @@ class BitshareCom(SimpleHoster): # Get download info self.logDebug("Getting download info") - response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "generateID", "ajaxid": self.ajaxid}) - self.handleErrors(response, ':') - parts = response.split(":") + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + post={"request": "generateID", "ajaxid": self.ajaxid}) + self.handleErrors(res, ':') + parts = res.split(":") filetype = parts[0] wait = int(parts[1]) captcha = int(parts[2]) @@ -116,37 +116,37 @@ class BitshareCom(SimpleHoster): # Try up to 3 times for i in xrange(3): challenge, code = recaptcha.challenge() - response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "validateCaptcha", "ajaxid": self.ajaxid, "recaptcha_challenge_field": challenge, "recaptcha_response_field": code}) - if self.handleCaptchaErrors(response): + if self.handleCaptchaErrors(res): break # Get download URL self.logDebug("Getting download url") - response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) - self.handleErrors(response, '#') - url = response.split("#")[-1] + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) + self.handleErrors(res, '#') + url = res.split("#")[-1] return url - def handleErrors(self, response, separator): - self.logDebug("Checking response [%s]" % response) - if "ERROR:Session timed out" in response: + def handleErrors(self, res, separator): + self.logDebug("Checking response [%s]" % res) + if "ERROR:Session timed out" in res: self.retry() - elif "ERROR" in response: - msg = response.split(separator)[-1] + elif "ERROR" in res: + msg = res.split(separator)[-1] self.fail(msg) - def handleCaptchaErrors(self, response): - self.logDebug("Result of captcha resolving [%s]" % response) - if "SUCCESS" in response: + def handleCaptchaErrors(self, res): + self.logDebug("Result of captcha resolving [%s]" % res) + if "SUCCESS" in res: self.correctCaptcha() return True - elif "ERROR:SESSION ERROR" in response: + elif "ERROR:SESSION ERROR" in res: self.retry() self.invalidCaptcha() -- cgit v1.2.3 From e8246525f3106c152d6d1436c6a3111e0334520f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 15 Nov 2014 18:04:47 +0100 Subject: Fix cookie domain --- module/plugins/hoster/BitshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 35aff7c1e..da393f8fc 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -24,7 +24,7 @@ class BitshareCom(SimpleHoster): INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.,]+) (?P[\w^_]+)' 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)' - COOKIES = [(".bitshare.com", "language_selection", "EN")] + COOKIES = [("bitshare.com", "language_selection", "EN")] AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!' -- cgit v1.2.3 From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/hoster/BitshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index da393f8fc..1483e5d1e 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -31,7 +31,7 @@ class BitshareCom(SimpleHoster): def setup(self): - self.multiDL = self.premium + self.multiDL = self.premium self.chunkLimit = 1 -- cgit v1.2.3 From 4d578cb15f3d6edd036e438e504739b97660f93e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 9 Dec 2014 16:58:35 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/BitshareCom.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 1483e5d1e..17d29680e 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -115,10 +115,12 @@ class BitshareCom(SimpleHoster): # Try up to 3 times for i in xrange(3): - challenge, code = recaptcha.challenge() + challenge, response = recaptcha.challenge() res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "validateCaptcha", "ajaxid": self.ajaxid, - "recaptcha_challenge_field": challenge, "recaptcha_response_field": code}) + post={"request" : "validateCaptcha", + "ajaxid" : self.ajaxid, + "recaptcha_challenge_field": challenge, + "recaptcha_response_field" : response}) if self.handleCaptchaErrors(res): break -- cgit v1.2.3 From 854efeb463bd98cb8e22f1f78f5ce97e6c0ab49f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 22 Dec 2014 16:45:04 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/BitshareCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 17d29680e..6a497f4bc 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -13,7 +13,7 @@ class BitshareCom(SimpleHoster): __type__ = "hoster" __version__ = "0.51" - __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P\w+)(/(?P.*?)\.html)?|\?f=(?P\w+))' + __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P\w+)(/(?P.*?)\.html)?|\?f=(?P\w+))' __description__ = """Bitshare.com hoster plugin""" __license__ = "GPLv3" @@ -43,7 +43,7 @@ class BitshareCom(SimpleHoster): # File id m = re.match(self.__pattern__, pyfile.url) - self.file_id = max(m.group('id1'), m.group('id2')) + self.file_id = max(m.group('ID1'), m.group('ID2')) self.logDebug("File id is [%s]" % self.file_id) # Load main page @@ -61,7 +61,7 @@ class BitshareCom(SimpleHoster): # File name m = re.match(self.__pattern__, pyfile.url) - name1 = m.group('name') if m else None + name1 = m.group('NAME') if m else None m = re.search(self.INFO_PATTERN, self.html) name2 = m.group('N') if m else None pyfile.name = max(name1, name2) -- cgit v1.2.3 From e1d4186c62512d8bb76d35b6f8d1828d8d0aa94e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 13:26:32 +0100 Subject: [SimpleHoster] Improve multi-hoster feature --- module/plugins/hoster/BitshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 6a497f4bc..a4fbde048 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -13,7 +13,7 @@ class BitshareCom(SimpleHoster): __type__ = "hoster" __version__ = "0.51" - __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P\w+)(/(?P.*?)\.html)?|\?f=(?P\w+))' + __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P\w+)(?(1)/(?P.*?)\.html)' __description__ = """Bitshare.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 7112d06dad8dc381d7d80030134cdef07f701aac Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 14:39:06 +0100 Subject: [BitshareCom] Code cosmetics --- module/plugins/hoster/BitshareCom.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index a4fbde048..50013cc43 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -21,13 +21,13 @@ class BitshareCom(SimpleHoster): ("fragonib", "fragonib[AT]yahoo[DOT]es")] - INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.,]+) (?P[\w^_]+)' - 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)' - COOKIES = [("bitshare.com", "language_selection", "EN")] - AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' - TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!' + INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.,]+) (?P[\w^_]+)' + OFFLINE_PATTERN = r'[Ff]ile (not available|was deleted|was not found)' + + AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' + TRAFFIC_USED_UP = r'Your Traffic is used up for today' def setup(self): @@ -39,8 +39,6 @@ class BitshareCom(SimpleHoster): if self.premium: self.account.relogin(self.user) - self.pyfile = pyfile - # File id m = re.match(self.__pattern__, pyfile.url) self.file_id = max(m.group('ID1'), m.group('ID2')) @@ -60,10 +58,12 @@ class BitshareCom(SimpleHoster): self.retry() # File name - m = re.match(self.__pattern__, pyfile.url) + m = re.match(self.__pattern__, pyfile.url) name1 = m.group('NAME') if m else None - m = re.search(self.INFO_PATTERN, self.html) + + m = re.search(self.INFO_PATTERN, self.html) name2 = m.group('N') if m else None + pyfile.name = max(name1, name2) # Ajax file id @@ -71,12 +71,13 @@ class BitshareCom(SimpleHoster): self.logDebug("File ajax id is [%s]" % self.ajaxid) # This may either download our file or forward us to an error page - url = self.getDownloadUrl() - self.download(url) + self.download(self.getDownloadUrl()) 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") @@ -92,11 +93,14 @@ class BitshareCom(SimpleHoster): self.logDebug("Getting download info") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "generateID", "ajaxid": self.ajaxid}) + self.handleErrors(res, ':') - parts = res.split(":") + + parts = res.split(":") filetype = parts[0] - wait = int(parts[1]) - captcha = int(parts[2]) + wait = int(parts[1]) + captcha = int(parts[2]) + self.logDebug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha)) # Waiting @@ -128,7 +132,9 @@ class BitshareCom(SimpleHoster): self.logDebug("Getting download url") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) + self.handleErrors(res, '#') + url = res.split("#")[-1] return url -- cgit v1.2.3 From cdb06469a640c1875229903a2dbdfa8be469b5bc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 13:52:30 +0100 Subject: Improve a lot of plugin __pattern__ --- module/plugins/hoster/BitshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 50013cc43..1c5c53f55 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -13,7 +13,7 @@ class BitshareCom(SimpleHoster): __type__ = "hoster" __version__ = "0.51" - __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P\w+)(?(1)/(?P.*?)\.html)' + __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P\w+)(?(1)/(?P.+?)\.html)' __description__ = """Bitshare.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3