summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hoster/YoutubeCom.py11
-rw-r--r--module/plugins/hoster/ZippyshareCom.py89
2 files changed, 61 insertions, 39 deletions
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 1db5fc0a4..316eebd4b 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -4,7 +4,6 @@
import re
import subprocess
import os
-import os.path
from urllib import unquote
from module.utils import html_unescape
@@ -37,7 +36,7 @@ class YoutubeCom(Hoster):
__name__ = "YoutubeCom"
__type__ = "hoster"
__pattern__ = r"https?://(?:[^/]*?)youtube\.com/watch.*?[?&]v=.*"
- __version__ = "0.34"
+ __version__ = "0.35"
__config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting", "hd"),
("fmt", "int", "FMT/ITAG Number (5-102, 0 for auto)", 0),
(".mp4", "bool", "Allow .mp4", True),
@@ -49,6 +48,9 @@ class YoutubeCom(Hoster):
__author_name__ = ("spoob", "zoidberg")
__author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
+ # Invalid characters that must be removed from the file name
+ invalidChars = ':?><"|\\'
+
# name, width, height, quality ranking, 3D
formats = {5: (".flv", 400, 240, 1, False),
6: (".flv", 640, 400, 4, False),
@@ -137,6 +139,11 @@ class YoutubeCom(Hoster):
file_suffix = self.formats[fmt][0] if fmt in self.formats else ".flv"
file_name_pattern = '<meta name="title" content="(.+?)">'
name = re.search(file_name_pattern, html).group(1).replace("/", "")
+
+ # Cleaning invalid characters from the file name
+ for c in self.invalidChars:
+ name = name.replace(c, '_')
+
pyfile.name = html_unescape(name)
time = re.search(r"t=((\d+)m)?(\d+)s", pyfile.url)
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index 661f90e20..a3b1cf783 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -15,7 +15,7 @@ class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
__pattern__ = r"(?P<HOST>http://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(?P<KEY>\d+)"
- __version__ = "0.40"
+ __version__ = "0.41"
__description__ = """Zippyshare.com Download Hoster"""
__author_name__ = ("spoob", "zoidberg", "stickell")
__author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
@@ -63,11 +63,11 @@ class ZippyshareCom(SimpleHoster):
def get_file_url(self):
""" returns the absolute downloadable filepath
"""
- url = multiply = modulo = None
+ url = None
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html, re.S)
- if found:
- #Method #1: JS eval
+ #Method #1: JS eval
+ if found and re.search(r'span id="omg" class="(\d*)"', self.html):
js = "\n".join(found.groups())
d = re.search(r'span id="omg" class="(\d*)"', self.html).group(1)
regex = r"document.getElementById\('omg'\).getAttribute\('class'\)"
@@ -75,41 +75,17 @@ class ZippyshareCom(SimpleHoster):
regex = r"document.getElementById\(\\*'dlbutton\\*'\).href = "
js = re.sub(regex, '', js)
url = self.js.eval(js)
+ elif found and re.search(r"document.getElementById\(\\*'dlbutton\\*'\).omg", self.html):
+ js = "\n".join(found.groups())
+ regex = r"document.getElementById\(\\*'dlbutton\\*'\).omg"
+ omg = re.search(regex + r" = ([^;]+);", js).group(1)
+ js = re.sub(regex + r" = ([^;]+);", '', js)
+ js = re.sub(regex, omg, js)
+ js = re.sub(r"document.getElementById\(\\*'dlbutton\\*'\).href = ", '', js)
+ url = self.js.eval(js)
else:
#Method #2: SWF eval
- seed_search = re.search(self.SEED_PATTERN, self.html)
- if seed_search:
- swf_url, file_seed = seed_search.groups()
-
- swf_sts = self.getStorage("swf_sts")
- swf_stamp = int(self.getStorage("swf_stamp") or 0)
- swf_version = self.getStorage("version")
- self.logDebug("SWF", swf_sts, swf_stamp, swf_version)
-
- if not swf_sts:
- self.logDebug('Using default values')
- multiply, modulo = self.LAST_KNOWN_VALUES
- elif swf_sts == "1":
- self.logDebug('Using stored values')
- multiply = self.getStorage("multiply")
- modulo = self.getStorage("modulo")
- elif swf_sts == "2":
- if swf_version < self.__version__:
- self.logDebug('Reverting to default values')
- self.setStorage("swf_sts", "")
- self.setStorage("version", self.__version__)
- multiply, modulo = self.LAST_KNOWN_VALUES
- elif (swf_stamp + 3600000) < timestamp():
- swfdump = self.get_swfdump_path()
- if swfdump:
- multiply, modulo = self.get_swf_values(self.file_info['HOST'] + swf_url, swfdump)
- else:
- self.logWarning("Swfdump not found. Install swftools to bypass captcha.")
-
- if multiply and modulo:
- self.logDebug("TIME = (%s * %s) %s" % (file_seed, multiply, modulo))
- url = "/download?key=%s&time=%d" % (self.file_info['KEY'],
- (int(file_seed) * int(multiply)) % int(modulo))
+ url = self.swf_eval()
if not url:
#Method #3: Captcha
@@ -117,6 +93,45 @@ class ZippyshareCom(SimpleHoster):
return self.file_info['HOST'] + url
+ def swf_eval(self):
+ multiply = modulo = None
+ seed_search = re.search(self.SEED_PATTERN, self.html)
+ if seed_search:
+ swf_url, file_seed = seed_search.groups()
+
+ swf_sts = self.getStorage("swf_sts")
+ swf_stamp = int(self.getStorage("swf_stamp") or 0)
+ swf_version = self.getStorage("version")
+ self.logDebug("SWF", swf_sts, swf_stamp, swf_version)
+
+ if not swf_sts:
+ self.logDebug('Using default values')
+ multiply, modulo = self.LAST_KNOWN_VALUES
+ elif swf_sts == "1":
+ self.logDebug('Using stored values')
+ multiply = self.getStorage("multiply")
+ modulo = self.getStorage("modulo")
+ elif swf_sts == "2":
+ if swf_version < self.__version__:
+ self.logDebug('Reverting to default values')
+ self.setStorage("swf_sts", "")
+ self.setStorage("version", self.__version__)
+ multiply, modulo = self.LAST_KNOWN_VALUES
+ elif (swf_stamp + 3600000) < timestamp():
+ swfdump = self.get_swfdump_path()
+ if swfdump:
+ multiply, modulo = self.get_swf_values(self.file_info['HOST'] + swf_url, swfdump)
+ else:
+ self.logWarning("Swfdump not found. Install swftools to bypass captcha.")
+
+ if multiply and modulo:
+ self.logDebug("TIME = (%s * %s) %s" % (file_seed, multiply, modulo))
+ url = "/download?key=%s&time=%d" % (self.file_info['KEY'],
+ (int(file_seed) * int(multiply)) % int(modulo))
+ return url
+
+ return None
+
def get_swf_values(self, swf_url, swfdump):
self.logDebug('Parsing values from %s' % swf_url)
multiply = modulo = None