From 4339a5e844b8593d5a4df2a84097e28878b19030 Mon Sep 17 00:00:00 2001 From: spoob Date: Tue, 26 May 2009 15:01:02 +0200 Subject: better youtube video id parsing, nicer testoutput --- Plugins/YoutubeCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Plugins/YoutubeCom.py') diff --git a/Plugins/YoutubeCom.py b/Plugins/YoutubeCom.py index 20a9bd7d1..0710711ea 100644 --- a/Plugins/YoutubeCom.py +++ b/Plugins/YoutubeCom.py @@ -9,12 +9,12 @@ class YoutubeCom(Plugin): def __init__(self, parent): Plugin.__init__(self, parent) - self.plugin_name = "Youtube.com" - self.plugin_pattern = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=(.*)" + self.plugin_name = "YoutubeCom" + self.plugin_pattern = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*" self.plugin_type = "hoster" self.plugin_config = {} pluginProp = {} - pluginProp ['name'] = "YoutubeCom" + pluginProp ['name'] = "Youtube.com" pluginProp ['version'] = "0.1" pluginProp ['format'] = "*.py" pluginProp ['description'] = """Youtube Plugin""" @@ -46,7 +46,7 @@ class YoutubeCom(Plugin): if self.html == None: self.download_html() - videoId = re.search(self.plugin_pattern, self.parent.url).group(3) + videoId = self.parent.url.split("v=")[1].split("&")[0] videoHash = re.search(r', "t": "([^"]+)"', self.html).group(1) file_url = 'http://youtube.com/get_video?video_id=' + videoId + '&t=' + videoHash + '&fmt=18' return file_url -- cgit v1.2.3