From 29f9dc8fb3396b03d732ebcbeb1cc8f00fe13897 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 25 Aug 2010 18:22:27 +0200 Subject: new dirs --- module/plugins/crypter/YoutubeBatch.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 module/plugins/crypter/YoutubeBatch.py (limited to 'module/plugins/crypter/YoutubeBatch.py') diff --git a/module/plugins/crypter/YoutubeBatch.py b/module/plugins/crypter/YoutubeBatch.py new file mode 100644 index 000000000..b48026654 --- /dev/null +++ b/module/plugins/crypter/YoutubeBatch.py @@ -0,0 +1,34 @@ +#!/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/.*?/user/(?P.{16})|(?:.*?feature=PlayList\&|view_play_list\?)p=(?P.{16}))" + __version__ = "0.9" + __description__ = """Youtube.com Channel Download Plugin""" + __author_name__ = ("RaNaN", "Spoob") + __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") + + def setup(self): + compile_id = re.compile(self.__pattern__) + match_id = compile_id.match(self.pyfile.url) + self.playlist = match_id.group(match_id.lastgroup) + + 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)) -- cgit v1.2.3