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 From fd105f8e51768ec1943cda2375bdfdbe5b0a3951 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 9 Jan 2015 00:35:51 +0100 Subject: "New Year" Update: hoster plugins --- module/plugins/hoster/BitshareCom.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/BitshareCom.py') diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 1c5c53f55..f7b4d2709 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.51" + __version__ = "0.52" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P\w+)(?(1)/(?P.+?)\.html)' @@ -73,12 +73,7 @@ class BitshareCom(SimpleHoster): # This may either download our file or forward us to an error page 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": + if self.checkDownload({"error": ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") -- cgit v1.2.3 From cf4ded052964047de88d676045329b8fa4fca2dc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 22 Jan 2015 21:31:19 +0100 Subject: Update plugins after CaptchaService changes --- 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 f7b4d2709..657e70e56 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.52" + __version__ = "0.53" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P\w+)(?(1)/(?P.+?)\.html)' @@ -114,7 +114,7 @@ class BitshareCom(SimpleHoster): # Try up to 3 times for i in xrange(3): - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request" : "validateCaptcha", "ajaxid" : self.ajaxid, -- cgit v1.2.3