diff options
author | spoob <spoob@gmx.de> | 2009-06-07 05:24:49 +0200 |
---|---|---|
committer | spoob <spoob@gmx.de> | 2009-06-07 05:24:49 +0200 |
commit | d10502f06d8178dceec8738386b153d9936d33fe (patch) | |
tree | 0942809317f9a036ef63cd0c13e87d11d273e4ed | |
parent | bluehost working, but slow (diff) | |
download | pyload-d10502f06d8178dceec8738386b153d9936d33fe.tar.xz |
added youtube max video and high quality config
-rw-r--r-- | Plugins/YoutubeChannel.py | 17 | ||||
-rw-r--r-- | Plugins/YoutubeCom.py | 13 | ||||
-rw-r--r-- | pluginconfig | 5 |
3 files changed, 25 insertions, 10 deletions
diff --git a/Plugins/YoutubeChannel.py b/Plugins/YoutubeChannel.py index 1a0af757e..a1204c086 100644 --- a/Plugins/YoutubeChannel.py +++ b/Plugins/YoutubeChannel.py @@ -9,16 +9,17 @@ class YoutubeChannel(Plugin): def __init__(self, parent): Plugin.__init__(self, parent) props = {} - props['name'] = "YouTubeChannel" + props['name'] = "YoutubeChannel" props['type'] = "container" props['pattern'] = r"http://(www\.)?(de\.)?\youtube\.com/user/*" - props['version'] = "0.1" + props['version'] = "0.2" props['description'] = """Youtube.com Channel Download Plugin""" - props['author_name'] = ("RaNaN") - props['author_mail'] = ("RaNaN@pyload.org") + props['author_name'] = ("RaNaN", "Spoob") + props['author_mail'] = ("RaNaN@pyload.org", "Spoob@pyload.org") self.props = props self.parent = parent self.html = None + self.read_config() def download_html(self): self.html = "Not needed" @@ -27,8 +28,10 @@ class YoutubeChannel(Plugin): """ returns the absolute downloadable filepath """ self.user = re.search(r"/user/(.+)", self.parent.url).group(1) - url = "http://gdata.youtube.com/feeds/api/users/" + self.user + "/uploads?max-results=50" - + max_videos = "" + if self.config['max_videos']: + max_videos = "?max-results=" + self.config['max_videos'] + url = "http://gdata.youtube.com/feeds/api/users/" + self.user + "/uploads" + max_videos return url def file_exists(self): @@ -38,4 +41,4 @@ class YoutubeChannel(Plugin): def proceed(self, url, location): rep = self.req.load(url) - self.links = re.findall(r"href\='(http:\/\/www.youtube.com\/watch\?v\=[^']+)", rep)
\ No newline at end of file + self.links = re.findall(r"href\='(http:\/\/www.youtube.com\/watch\?v\=[^']+)", rep) diff --git a/Plugins/YoutubeCom.py b/Plugins/YoutubeCom.py index 0d738d52d..2d8567a28 100644 --- a/Plugins/YoutubeCom.py +++ b/Plugins/YoutubeCom.py @@ -11,13 +11,14 @@ class YoutubeCom(Plugin): props['name'] = "YoutubeCom" props['type'] = "hoster" props['pattern'] = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*" - props['version'] = "0.1" + props['version'] = "0.2" props['description'] = """Youtube.com Video Download Plugin""" props['author_name'] = ("spoob") props['author_mail'] = ("spoob@pyload.org") self.props = props self.parent = parent self.html = None + self.read_config() def download_html(self): url = self.parent.url @@ -31,7 +32,10 @@ class YoutubeCom(Plugin): 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' + quality = "" + if self.config['high_quality']: + quality = "&fmt=18" + file_url = 'http://youtube.com/get_video?video_id=' + videoId + '&t=' + videoHash + quality return file_url def get_file_name(self): @@ -39,7 +43,10 @@ class YoutubeCom(Plugin): self.download_html() file_name_pattern = r"<title>YouTube - (.*)</title>" - return re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.mp4' + file_suffix = ".flv" + if self.config['high_quality']: + file_suffix = ".mp4" + return re.search(file_name_pattern, self.html).group(1).replace("/", "") + file_suffix def file_exists(self): """ returns True or False diff --git a/pluginconfig b/pluginconfig index 4a886bcfb..0b72f9716 100644 --- a/pluginconfig +++ b/pluginconfig @@ -2,3 +2,8 @@ premium = False username = user password = pass +[YoutubeCom] +high_quality = True +[YoutubeChannel] +#type False for no limitation +max_videos = 50 |