diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-12 17:04:03 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-12 17:04:03 +0200 |
commit | c2c3a39f1c4e09f070b85d350eef5fb6a319cb48 (patch) | |
tree | c03205cde143768e80d656a3cce7de9fa17dee82 /module | |
parent | XMPP Interface (diff) | |
parent | Youtube Playlist Download (diff) | |
download | pyload-c2c3a39f1c4e09f070b85d350eef5fb6a319cb48.tar.xz |
merge
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/crypter/YoutubeBatch.py | 33 | ||||
-rw-r--r-- | module/plugins/crypter/YoutubeChannel.py | 52 | ||||
-rw-r--r-- | module/plugins/hoster/YoutubeCom.py | 2 |
3 files changed, 34 insertions, 53 deletions
diff --git a/module/plugins/crypter/YoutubeBatch.py b/module/plugins/crypter/YoutubeBatch.py new file mode 100644 index 000000000..091c8558a --- /dev/null +++ b/module/plugins/crypter/YoutubeBatch.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter + +class YoutubeBatch(Crypter): + __name__ = "YoutubeBatch" + __type__ = "container" + __pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/user/*" + __version__ = "0.9" + __description__ = """Youtube.com Channel Download Plugin""" + __author_name__ = ("RaNaN", "Spoob") + __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") + + def setup(self): + self.user = re.search(r"/user/(.+)", self.pyfile.url).group(1).split("#")[0] + self.playlist = re.search(r"/user/%s.*?/user/(.{16})" % self.user, self.pyfile.url).group(1) + + def file_exists(self): + if "User not found" in self.req.load("http://gdata.youtube.com/feeds/api/playlists/%s?v=2" % self.playlist): + return False + return True + + def decrypt(self, pyfile): + if not self.file_exists(): + self.offline() + url = "http://gdata.youtube.com/feeds/api/playlists/%s?v=2" % self.playlist + rep = self.load(url) + new_links = [] + new_links.extend(re.findall(r"href\='(http:\/\/www.youtube.com\/watch\?v\=[^']+)&", rep)) + self.packages.append((self.pyfile.package().name, new_links, self.pyfile.package().name)) diff --git a/module/plugins/crypter/YoutubeChannel.py b/module/plugins/crypter/YoutubeChannel.py deleted file mode 100644 index 292be06af..000000000 --- a/module/plugins/crypter/YoutubeChannel.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import re - -from module.plugins.Crypter import Crypter - -class YoutubeChannel(Crypter): - __name__ = "YoutubeChannel" - __type__ = "container" - __pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/user/*" - __version__ = "0.9" - __description__ = """Youtube.com Channel Download Plugin""" - __author_name__ = ("RaNaN", "Spoob") - __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") - - def __init__(self, parent): - Crypter.__init__(self, parent) - self.parent = parent - self.html = None - self.read_config() - self.user = re.search(r"/user/(.+)", self.parent.url).group(1).split("#")[0] - - def file_exists(self): - if "User not found" in self.req.load("http://gdata.youtube.com/feeds/api/users/%s" % self.user): - return False - return True - - def proceed(self, url, location): - max_videos = self.config['max_videos'] - if not max_videos: - max_videos = 1000 #max video a user can upload - page = 0 - temp_links = [] - if "," in self.config['video_groups']: - video_groups = self.config['video_groups'].split(",") - else: - video_groups = [self.config['video_groups']] - for group in video_groups: - for start_index in range(1, int(max_videos), 50): - max_results = max_videos - page * 50 - if max_results > 50: - max_results = 50 - url = "http://gdata.youtube.com/feeds/api/users/%s/%s?max-results=%i&start-index=%i" % (self.user, group, max_results, start_index) - rep = self.req.load(url) - new_links = re.findall(r"href\='(http:\/\/www.youtube.com\/watch\?v\=[^']+)&", rep) - if new_links != []: - temp_links.extend(new_links) - else: - break - page += 1 - self.links = temp_links diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index e40b0c9ad..6148d72f0 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -45,4 +45,4 @@ class YoutubeCom(Hoster): file_url = 'http://youtube.com/get_video?video_id=' + videoId + '&t=' + videoHash + quality + "&asv=2" - self.download(file_url)
\ No newline at end of file + self.download(file_url) |