From ba1ba7f123e517fef53d03c91308069f9d40ad2c Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Wed, 12 Aug 2015 01:04:03 +0300 Subject: [YoutubeCom] fix #1744 --- module/plugins/hoster/YoutubeCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/YoutubeCom.py') diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 865eeef2e..86cca7cf1 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -33,7 +33,7 @@ def which(program): class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.45" __status__ = "testing" __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+' @@ -54,7 +54,7 @@ class YoutubeCom(Hoster): URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')] #: Invalid characters that must be removed from the file name - invalidChars = u'\u2605:?><"|\\' + invalid_chars = u'\u2605:?><"|\\' #: name, width, height, quality ranking, 3D formats = {5 : (".flv" , 400 , 240 , 1 , False), -- cgit v1.2.3 From 92dd8f10b58a6fe20d40e08e081f6311eb8c592d Mon Sep 17 00:00:00 2001 From: B1gG Date: Thu, 27 Aug 2015 07:45:21 -0430 Subject: Update to resolve issue #1793 This update resolve the issue raised when you try to share a link from YouTube android app to pyLoad client. Issue was that the parser doesn't detect youtu.be as a valid URL for YoutubeCom.py and always use BasePlugin.py instead of, that is why the "__pattern__" need to be modified. The URL_REPLACEMENTS is not appropriate for this short url and was fixed also, in order to construct and typical youtube.com URL, that this script can handle. --- module/plugins/hoster/YoutubeCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/YoutubeCom.py') diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 86cca7cf1..9c7421be1 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -36,7 +36,7 @@ class YoutubeCom(Hoster): __version__ = "0.45" __status__ = "testing" - __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+' + __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com/watch\?v=|youtu\.be)(?:.*)' __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ), ("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ), (".mp4" , "bool" , "Allow .mp4" , True ), @@ -51,7 +51,7 @@ class YoutubeCom(Hoster): ("zoidberg", "zoidberg@mujmail.cz")] - URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')] + URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/watch?v=')] #: Invalid characters that must be removed from the file name invalid_chars = u'\u2605:?><"|\\' -- cgit v1.2.3 From f44acc14fc6492f9fefbc707618c774d34ac1aeb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 30 Aug 2015 03:38:54 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1793 --- module/plugins/hoster/YoutubeCom.py | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'module/plugins/hoster/YoutubeCom.py') diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 9c7421be1..5c7c13962 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -6,37 +6,17 @@ import subprocess import urllib from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.Plugin import replace_patterns +from module.plugins.internal.Plugin import replace_patterns, which from module.utils import html_unescape -def which(program): - """ - Works exactly like the unix command which - Courtesy of http://stackoverflow.com/a/377028/675646 - """ - isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) - - fpath, fname = os.path.split(program) - - if fpath: - if isExe(program): - return program - else: - for path in os.environ['PATH'].split(os.pathsep): - path = path.strip('"') - exe_file = os.path.join(path, program) - if isExe(exe_file): - return exe_file - - class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __status__ = "testing" - __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com/watch\?v=|youtu\.be)(?:.*)' + __pattern__ = r'https?://(?:[^/]*\.)?(youtu\.be/|youtube\.com/watch\?(?:.*&)?v=)\w+' __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ), ("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ), (".mp4" , "bool" , "Allow .mp4" , True ), -- cgit v1.2.3