From 678f488777a94522ce8ba68f106428eefa037f50 Mon Sep 17 00:00:00 2001
From: sebdelsol <seb.morin@gmail.com>
Date: Mon, 9 Mar 2015 21:42:19 +0100
Subject: [ZippyShare] Bug #1238 correction

* remove non ascii character from the id part in the js variable name.
* change the RE so that it works for any character in the id name
---
 module/plugins/hoster/ZippyshareCom.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index 9d7c6949f..f2c99de7b 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 class ZippyshareCom(SimpleHoster):
     __name__    = "ZippyshareCom"
     __type__    = "hoster"
-    __version__ = "0.74"
+    __version__ = "0.75"
 
     __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)'
 
@@ -64,7 +64,7 @@ class ZippyshareCom(SimpleHoster):
             id   = element.group(1)
             attr = element.group(4)  #: attr might be None
 
-            varName    = '%s_%s' % (id, attr)
+            varName    = '%s_%s' % (re.sub(r'\W', '', id), attr)
             initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=id)])
             initValue  = '"%s"' % initValues[-1] if initValues else 'null'
 
@@ -72,7 +72,7 @@ class ZippyshareCom(SimpleHoster):
             return varName
 
         # handle all getElementById
-        reVar = r'document.getElementById\([\'"](\w+)[\'"]\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?'
+        reVar = r'document.getElementById\([\'"](.+)[\'"]\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?'
         scripts = [re.sub(reVar, replElementById, script) for script in scripts]
 
         # add try/catch in JS to handle deliberate errors
-- 
cgit v1.2.3