From 20b6a2ec022202b0efb6cb69415239fb8f4d1445 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 18:59:20 +0200 Subject: Spare code cosmetics (2) --- module/plugins/hoster/ZippyshareCom.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index d776e5928..7bae8cc19 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -58,35 +58,35 @@ class ZippyshareCom(SimpleHoster): def get_link(self): - # get all the scripts inside the html body + #: get all the scripts inside the html body soup = BeautifulSoup(self.html) scripts = (s.getText().strip() for s in soup.body.findAll('script', type='text/javascript')) - # meant to be populated with the initialization of all the DOM elements found in the scripts + #: meant to be populated with the initialization of all the DOM elements found in the scripts initScripts = set() def replElementById(element): - id = element.group(1) # id might be either 'x' (a real id) or x (a variable) - attr = element.group(4) # attr might be None + id = element.group(1) #: id might be either 'x' (a real id) or x (a variable) + attr = element.group(4) #: attr might be None varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) realid = id.strip('"\'') - if id != realid: #id is not a variable, so look for realid.attr in the html + if id != realid: #: id is not a variable, so look for realid.attr in the html initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) initValue = '"%s"' % initValues[-1] if initValues else 'null' initScripts.add('%s = %s;' % (varName, initValue)) return varName - # handle all getElementById + #: handle all getElementById reVar = r'document.getElementById\(([\'"\w-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?' scripts = [re.sub(reVar, replElementById, script) for script in scripts if script] - # add try/catch in JS to handle deliberate errors + #: add try/catch in JS to handle deliberate errors scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] - # get the file's url by evaluating all the scripts + #: get the file's url by evaluating all the scripts scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]'] return self.js.eval('\n'.join(scripts)) -- cgit v1.2.3 From 9305859b64a2f0aef3f27fb7e5b75caa0cb836a6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 19:24:49 +0200 Subject: Spare code cosmetics (3) --- module/plugins/hoster/ZippyshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 7bae8cc19..302554624 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -87,7 +87,7 @@ class ZippyshareCom(SimpleHoster): scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] #: get the file's url by evaluating all the scripts - scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]'] + scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR['dlbutton_href']'] return self.js.eval('\n'.join(scripts)) -- cgit v1.2.3 From b1759bc440cd6013837697eb8de540914f693ffd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Jul 2015 01:23:55 +0200 Subject: No camelCase style anymore --- module/plugins/hoster/ZippyshareCom.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 302554624..80d495f78 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.79" + __version__ = "0.80" __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -33,12 +33,12 @@ class ZippyshareCom(SimpleHoster): def setup(self): - self.chunkLimit = -1 - self.multiDL = True - self.resumeDownload = True + self.chunk_limit = -1 + self.multi_dl = True + self.resume_download = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() @@ -65,7 +65,7 @@ class ZippyshareCom(SimpleHoster): #: meant to be populated with the initialization of all the DOM elements found in the scripts initScripts = set() - def replElementById(element): + def repl_element_by_id(element): id = element.group(1) #: id might be either 'x' (a real id) or x (a variable) attr = element.group(4) #: attr might be None @@ -81,7 +81,7 @@ class ZippyshareCom(SimpleHoster): #: handle all getElementById reVar = r'document.getElementById\(([\'"\w-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?' - scripts = [re.sub(reVar, replElementById, script) for script in scripts if script] + scripts = [re.sub(reVar, repl_element_by_id, script) for script in scripts if script] #: add try/catch in JS to handle deliberate errors scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] -- cgit v1.2.3 From 9e5d813d7721e351ac02ba72bdc473a7d77ba6b7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 18 Jul 2015 20:04:36 +0200 Subject: Code cosmetics --- module/plugins/hoster/ZippyshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 80d495f78..48c17ea5f 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -3,7 +3,7 @@ import re import urllib -from BeautifulSoup import BeautifulSoup +import BeautifulSoup from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -59,7 +59,7 @@ class ZippyshareCom(SimpleHoster): def get_link(self): #: get all the scripts inside the html body - soup = BeautifulSoup(self.html) + soup = BeautifulSoup.BeautifulSoup(self.html) scripts = (s.getText().strip() for s in soup.body.findAll('script', type='text/javascript')) #: meant to be populated with the initialization of all the DOM elements found in the scripts -- cgit v1.2.3 From dad722ac7255640e7e0541c4094a4d2e4de79cd3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 00:05:58 +0200 Subject: Code cosmetics (2) --- module/plugins/hoster/ZippyshareCom.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 48c17ea5f..1881f66bb 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -58,35 +58,35 @@ class ZippyshareCom(SimpleHoster): def get_link(self): - #: get all the scripts inside the html body + #: Get all the scripts inside the html body soup = BeautifulSoup.BeautifulSoup(self.html) scripts = (s.getText().strip() for s in soup.body.findAll('script', type='text/javascript')) - #: meant to be populated with the initialization of all the DOM elements found in the scripts + #: Meant to be populated with the initialization of all the DOM elements found in the scripts initScripts = set() def repl_element_by_id(element): - id = element.group(1) #: id might be either 'x' (a real id) or x (a variable) - attr = element.group(4) #: attr might be None + id = element.group(1) #: Id might be either 'x' (a real id) or x (a variable) + attr = element.group(4) #: Attr might be None varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) realid = id.strip('"\'') - if id != realid: #: id is not a variable, so look for realid.attr in the html + if id != realid: #: Id is not a variable, so look for realid.attr in the html initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) initValue = '"%s"' % initValues[-1] if initValues else 'null' initScripts.add('%s = %s;' % (varName, initValue)) return varName - #: handle all getElementById + #: Handle all getElementById reVar = r'document.getElementById\(([\'"\w-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?' scripts = [re.sub(reVar, repl_element_by_id, script) for script in scripts if script] - #: add try/catch in JS to handle deliberate errors + #: Add try/catch in JS to handle deliberate errors scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] - #: get the file's url by evaluating all the scripts + #: Get the file's url by evaluating all the scripts scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR['dlbutton_href']'] return self.js.eval('\n'.join(scripts)) -- cgit v1.2.3 From d38e830b7c0b3c6561a0072c74bbccb5fcdf4a61 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 14:43:42 +0200 Subject: New __status__ magic key --- module/plugins/hoster/ZippyshareCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 1881f66bb..7df13a075 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -13,6 +13,7 @@ class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" __version__ = "0.80" + __status__ = "stable" __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] -- cgit v1.2.3 From 6af9b38a8d5d49355b85aef6ddd003605d6bba05 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Jul 2015 23:44:45 +0200 Subject: Improve Captcha --- module/plugins/hoster/ZippyshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 7df13a075..aa64c1903 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -5,7 +5,7 @@ import urllib import BeautifulSoup -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -- cgit v1.2.3 From 94d017cd2a5c1f194960827a8c7e46afc3682008 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 06:55:49 +0200 Subject: Hotfixes (2) --- module/plugins/hoster/ZippyshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index aa64c1903..f75068e58 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -13,7 +13,7 @@ class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" __version__ = "0.80" - __status__ = "stable" + __status__ = "testing" __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -35,7 +35,7 @@ class ZippyshareCom(SimpleHoster): def setup(self): self.chunk_limit = -1 - self.multi_dl = True + self.multiDL = True self.resume_download = True -- cgit v1.2.3 From 761ca5c66e07559925ebbdbc6531f9ca658b12ce Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 16:11:58 +0200 Subject: Code cosmetics --- module/plugins/hoster/ZippyshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index f75068e58..e48627618 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -54,7 +54,7 @@ class ZippyshareCom(SimpleHoster): else: self.link = self.get_link() - if self.link and pyfile.name == 'file.html': + if self.link and pyfile.name == "file.html": pyfile.name = urllib.unquote(self.link.split('/')[-1]) @@ -73,7 +73,7 @@ class ZippyshareCom(SimpleHoster): varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) realid = id.strip('"\'') - if id != realid: #: Id is not a variable, so look for realid.attr in the html + if id not is realid: #: Id is not a variable, so look for realid.attr in the html initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) initValue = '"%s"' % initValues[-1] if initValues else 'null' initScripts.add('%s = %s;' % (varName, initValue)) -- cgit v1.2.3 From dd13825fbd3df9e441200638cd2a92e3924dfff6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 23:57:04 +0200 Subject: Fix typo --- module/plugins/hoster/ZippyshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index e48627618..c9f9c8ce7 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -73,7 +73,7 @@ class ZippyshareCom(SimpleHoster): varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) realid = id.strip('"\'') - if id not is realid: #: Id is not a variable, so look for realid.attr in the html + if id is not realid: #: Id is not a variable, so look for realid.attr in the html initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) initValue = '"%s"' % initValues[-1] if initValues else 'null' initScripts.add('%s = %s;' % (varName, initValue)) -- cgit v1.2.3 From 5745baca2dd9c8831631489781ef950af5184081 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Jul 2015 22:06:31 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1520 --- module/plugins/hoster/ZippyshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index c9f9c8ce7..90f88bb02 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.80" + __version__ = "0.81" __status__ = "testing" __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P[\w^_]+)' @@ -88,7 +88,7 @@ class ZippyshareCom(SimpleHoster): scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] #: Get the file's url by evaluating all the scripts - scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR['dlbutton_href']'] + scripts = ["var GVAR = {}"] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]'] return self.js.eval('\n'.join(scripts)) -- cgit v1.2.3 From 5cbe43186c02a0f491a05357008df3985c60b1d6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 31 Jul 2015 10:43:08 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1543 --- module/plugins/hoster/ZippyshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/ZippyshareCom.py') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 90f88bb02..1b29948ce 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -12,10 +12,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.81" + __version__ = "0.82" __status__ = "testing" - __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P[\w^_]+)' + __pattern__ = r'http://www\d{0,3}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Zippyshare.com hoster plugin""" -- cgit v1.2.3