diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-08-30 03:38:54 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-08-30 03:38:54 +0200 |
commit | f44acc14fc6492f9fefbc707618c774d34ac1aeb (patch) | |
tree | b091de5877b31f4cbf8aff8ba0e5a1259fbde19c | |
parent | Merge pull request #1779 from GammaC0de/patch-5 (diff) | |
download | pyload-f44acc14fc6492f9fefbc707618c774d34ac1aeb.tar.xz |
Fix https://github.com/pyload/pyload/issues/1793
-rw-r--r-- | module/plugins/hoster/YoutubeCom.py | 26 | ||||
-rw-r--r-- | module/plugins/internal/Plugin.py | 22 |
2 files changed, 24 insertions, 24 deletions
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 ), diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 7b45c40a8..1e04d388e 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -54,6 +54,26 @@ def fixurl(url): #@TODO: Move to utils in 0.4.10 def timestamp(): return int(time.time() * 1000) + + +#@TODO: Move to utils in 0.4.10 +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): + exe_file = os.path.join(path.strip('"'), program) + if isExe(exe_file): + return exe_file def seconds_to_midnight(gmt=0): @@ -146,7 +166,7 @@ def chunks(iterable, size): class Plugin(object): __name__ = "Plugin" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" __status__ = "testing" __pattern__ = r'^unmatchable$' |