summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/ZippyshareCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/ZippyshareCom.py')
-rw-r--r--module/plugins/hoster/ZippyshareCom.py41
1 files changed, 21 insertions, 20 deletions
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index d776e5928..1b29948ce 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -3,18 +3,19 @@
import re
import urllib
-from BeautifulSoup import BeautifulSoup
+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
class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
- __version__ = "0.79"
+ __version__ = "0.82"
+ __status__ = "testing"
- __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)'
+ __pattern__ = r'http://www\d{0,3}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)'
__config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """Zippyshare.com hoster plugin"""
@@ -33,12 +34,12 @@ class ZippyshareCom(SimpleHoster):
def setup(self):
- self.chunkLimit = -1
+ self.chunk_limit = -1
self.multiDL = True
- self.resumeDownload = True
+ self.resume_download = True
- def handleFree(self, pyfile):
+ def handle_free(self, pyfile):
recaptcha = ReCaptcha(self)
captcha_key = recaptcha.detect_key()
@@ -53,41 +54,41 @@ 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])
def get_link(self):
- # get all the scripts inside the html body
- soup = BeautifulSoup(self.html)
+ #: 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 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
+ 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
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 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))
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]
+ 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
- scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]']
+ #: 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))