From 40016145c47e9735176510f86410cf25a04ab4d4 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Wed, 4 Feb 2015 15:06:01 +0100 Subject: [New Hoster] basketbuild.com I want to download my android stuff via pyLoad ;) --- module/plugins/hoster/BasketbuildCom.py | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 module/plugins/hoster/BasketbuildCom.py (limited to 'module/plugins/hoster/BasketbuildCom.py') diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py new file mode 100644 index 000000000..651470e54 --- /dev/null +++ b/module/plugins/hoster/BasketbuildCom.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://s.basketbuild.com/filedl/devs?dev=pacman&dl=pacman/falcon/RC-3/pac_falcon-RC-3-20141103.zip +# https://s.basketbuild.com/filedl/gapps?dl=gapps-gb-20110828-signed.zip + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class BasketbuildCom(SimpleHoster): + __name__ = "BasketbuildCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'https?://(?:www\.)?\w.basketbuild.com/filedl/.+' + + __description__ = """basketbuild.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'File Name: (?P.*?)
' + SIZE_PATTERN = r'File Size: (?P[\d.,]+) (?P[\w^_]+)
' + OFFLINE_PATTERN = r'404 - Page Not Found' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + link1 = re.search(r'href="(.+dlgate/.+)"',self.html) + try: + self.logDebug("Next hop: %s" % link1.group(1)) + self.html = self.load(link1.group(1), cookies=True) + except AttributeError: + self.error(_("Hop #1 not found")) + + wait = re.search(r'var sec = (\d+);',self.html) + try: + self.logDebug("Wait %s seconds" % wait.group(1)) + self.wait(wait.group(1)) + except AttributeError: + self.logDebug("No wait time found") + + link2 = re.search(r'id="dlLink">\s* Date: Sat, 7 Feb 2015 23:25:27 +0100 Subject: [BasketbuildCom] Cleanup --- module/plugins/hoster/BasketbuildCom.py | 39 +++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'module/plugins/hoster/BasketbuildCom.py') diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py index 651470e54..f3d430c5b 100644 --- a/module/plugins/hoster/BasketbuildCom.py +++ b/module/plugins/hoster/BasketbuildCom.py @@ -12,17 +12,17 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BasketbuildCom(SimpleHoster): __name__ = "BasketbuildCom" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" - __pattern__ = r'https?://(?:www\.)?\w.basketbuild.com/filedl/.+' + __pattern__ = r'https?://(?:www\.)?\w\.basketbuild\.com/filedl/.+' __description__ = """basketbuild.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - NAME_PATTERN = r'File Name: (?P.*?)
' - SIZE_PATTERN = r'File Size: (?P[\d.,]+) (?P[\w^_]+)
' + NAME_PATTERN = r'File Name: (?P.+?)
' + SIZE_PATTERN = r'File Size: (?P[\d.,]+) (?P[\w^_]+)' OFFLINE_PATTERN = r'404 - Page Not Found' @@ -33,27 +33,34 @@ class BasketbuildCom(SimpleHoster): def handleFree(self, pyfile): - link1 = re.search(r'href="(.+dlgate/.+)"',self.html) try: - self.logDebug("Next hop: %s" % link1.group(1)) - self.html = self.load(link1.group(1), cookies=True) + link1 = re.search(r'href="(.+dlgate/.+)"', self.html).group(1) + self.html = self.load(link1) + except AttributeError: self.error(_("Hop #1 not found")) - - wait = re.search(r'var sec = (\d+);',self.html) + + else: + self.logDebug("Next hop: %s" % link1) + try: - self.logDebug("Wait %s seconds" % wait.group(1)) - self.wait(wait.group(1)) + wait = re.search(r'var sec = (\d+)', self.html).group(1) + self.logDebug("Wait %s seconds" % wait) + self.wait(wait) + except AttributeError: self.logDebug("No wait time found") - - link2 = re.search(r'id="dlLink">\s*
\s* Date: Sun, 8 Feb 2015 01:08:05 +0100 Subject: [BasketbuildCom] Improved __pattern__ The "s." in the domain can be absent --- module/plugins/hoster/BasketbuildCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/BasketbuildCom.py') diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py index f3d430c5b..32380810f 100644 --- a/module/plugins/hoster/BasketbuildCom.py +++ b/module/plugins/hoster/BasketbuildCom.py @@ -12,9 +12,9 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BasketbuildCom(SimpleHoster): __name__ = "BasketbuildCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" - __pattern__ = r'https?://(?:www\.)?\w\.basketbuild\.com/filedl/.+' + __pattern__ = r'https?://(?:www\.)?(?:\w\.)?basketbuild\.com/filedl/.+' __description__ = """basketbuild.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 6616c00ba1c40f5d56959bd0e4725f26250e1292 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 9 Feb 2015 17:42:31 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/BasketbuildCom.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'module/plugins/hoster/BasketbuildCom.py') diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py index 32380810f..db482c7c5 100644 --- a/module/plugins/hoster/BasketbuildCom.py +++ b/module/plugins/hoster/BasketbuildCom.py @@ -52,15 +52,10 @@ class BasketbuildCom(SimpleHoster): self.logDebug("No wait time found") try: - link2 = re.search(r'id="dlLink">\s*\s* Date: Wed, 25 Mar 2015 23:10:07 +0100 Subject: __config__ cosmetics --- module/plugins/hoster/BasketbuildCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/BasketbuildCom.py') diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py index db482c7c5..89e4d39f9 100644 --- a/module/plugins/hoster/BasketbuildCom.py +++ b/module/plugins/hoster/BasketbuildCom.py @@ -15,6 +15,7 @@ class BasketbuildCom(SimpleHoster): __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?(?:\w\.)?basketbuild\.com/filedl/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """basketbuild.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3