summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/ZippyshareCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-19 00:05:58 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-19 00:05:58 +0200
commitdad722ac7255640e7e0541c4094a4d2e4de79cd3 (patch)
tree893a08e83fb9b465cd0ecf0b0315a5e820b06b06 /module/plugins/hoster/ZippyshareCom.py
parent[Hoster] Fix the http request issue (diff)
downloadpyload-dad722ac7255640e7e0541c4094a4d2e4de79cd3.tar.xz
Code cosmetics (2)
Diffstat (limited to 'module/plugins/hoster/ZippyshareCom.py')
-rw-r--r--module/plugins/hoster/ZippyshareCom.py16
1 files changed, 8 insertions, 8 deletions
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))