diff options
author | Stefano <l.stickell@yahoo.it> | 2013-10-03 18:38:37 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-10-07 11:28:13 +0200 |
commit | ed826f2c7744ad8de95c145536796dd618c7ef85 (patch) | |
tree | 394c6ed96db9d3f41f79c6c50aefa98d5aadd864 /pyload/plugins/hoster | |
parent | Zippyshare: fixed #292 (diff) | |
download | pyload-ed826f2c7744ad8de95c145536796dd618c7ef85.tar.xz |
YouTube: fixed #287
(cherry picked from commit d72e77a27e371a793e53b5c4cd247a5e31919b1d)
Diffstat (limited to 'pyload/plugins/hoster')
-rw-r--r-- | pyload/plugins/hoster/YoutubeCom.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pyload/plugins/hoster/YoutubeCom.py b/pyload/plugins/hoster/YoutubeCom.py index 1db5fc0a4..316eebd4b 100644 --- a/pyload/plugins/hoster/YoutubeCom.py +++ b/pyload/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) |