diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-10-26 08:50:33 +0200 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-10-26 08:50:33 +0200 |
commit | 0ed9a4701df16cfbc06330c51fcf049b32e6258a (patch) | |
tree | b8edf619cc823658ed3ff3fef417255d6eba076b /module/plugins/hoster/YoutubeCom.py | |
parent | rapidgator.net, shareonline.biz - closed #701 (diff) | |
download | pyload-0ed9a4701df16cfbc06330c51fcf049b32e6258a.tar.xz |
update youtube plugin - closed #686
Diffstat (limited to 'module/plugins/hoster/YoutubeCom.py')
-rw-r--r-- | module/plugins/hoster/YoutubeCom.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 222e9bf84..c1812a8fb 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -10,8 +10,8 @@ from module.plugins.Hoster import Hoster class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*" - __version__ = "0.25" + __pattern__ = r"(http|https)://(www\.)?(de\.)?\youtube\.com/watch\?v=.*" + __version__ = "0.26" __config__ = [("quality", "sd;hd;fullhd", "Quality Setting", "hd"), ("fmt", "int", "FMT Number 0-45", 0), (".mp4", "bool", "Allow .mp4", True), @@ -19,8 +19,8 @@ class YoutubeCom(Hoster): (".webm", "bool", "Allow .webm", False), (".3gp", "bool", "Allow .3gp", False)] __description__ = """Youtube.com Video Download Hoster""" - __author_name__ = ("spoob") - __author_mail__ = ("spoob@pyload.org") + __author_name__ = ("spoob", "zoidberg") + __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") # name, width, height, quality ranking formats = {17: (".3gp", 176, 144, 0), @@ -63,22 +63,20 @@ class YoutubeCom(Hoster): if self.getConfig("fmt"): desired_fmt = self.getConf("fmt") - - flashvars = re.search(r'flashvars=\\"(.*?)\\"', html) - flashvars = unquote(flashvars.group(1)) - - fmts = re.findall(r'url=(.*?)%3B.*?itag=(\d+)', flashvars) + + streams = unquote(re.search(r'url_encoded_fmt_stream_map=(.*?);', html).group(1)) + streams = [x.split('&') for x in streams.split(',')] + streams = [dict((y.split('=')) for y in x) for x in streams] fmt_dict = {} - for url, fmt in fmts: - fmt = int(fmt) - fmt_dict[fmt] = unquote(url) - + for x in streams: + x.update(itag=int(x['itag']), url=unquote(x['url']), type=unquote(x['type'])) + fmt_dict[x['itag']] = "%s&signature=%s" % (x['url'], x['sig']) self.logDebug("Found links: %s" % fmt_dict) for fmt in fmt_dict.keys(): if fmt not in self.formats: - self.logDebug("FMT not supported: %s" % fmt) - del fmt_dict[fmt] + self.logDebug("FMT not supported: %s" % fmt) + del fmt_dict[fmt] allowed = lambda x: self.getConfig(self.formats[x][0]) sel = lambda x: self.formats[x][3] #select quality index @@ -90,11 +88,13 @@ class YoutubeCom(Hoster): allowed(x) else y, fmt_dict.keys()) self.logDebug("Choose fmt: %s" % fmt) + url = fmt_dict[fmt] + self.logDebug("URL: %s" % url) file_suffix = ".flv" if fmt in self.formats: file_suffix = self.formats[fmt][0] name = re.search(file_name_pattern, html).group(1).replace("/", "") + file_suffix pyfile.name = html_unescape(name) - - self.download(fmt_dict[fmt]) + + self.download(url)
\ No newline at end of file |