From 35742c2cb023ac49ab3056752d2040cdb030cc2b Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 1 Jan 2012 13:36:59 +0100 Subject: Happy new Year ! --- module/plugins/crypter/LinkList.py | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 module/plugins/crypter/LinkList.py (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/LinkList.py b/module/plugins/crypter/LinkList.py new file mode 100644 index 000000000..8e46f88a9 --- /dev/null +++ b/module/plugins/crypter/LinkList.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from module.plugins.Crypter import Crypter, Package + +class LinkList(Crypter): + __name__ = "LinkList" + __version__ = "0.11" + __pattern__ = r".+\.txt$" + __description__ = """Read Link Lists in txt format""" + __author_name__ = ("spoob", "jeix") + __author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com") + + def decryptFile(self, content): + links = content.splitlines() + + curPack = "default" + packages = {curPack:[]} + + for link in links: + link = link.strip() + if not link: continue + + if link.startswith(";"): + continue + if link.startswith("[") and link.endswith("]"): + # new package + curPack = link[1:-1] + packages[curPack] = [] + continue + packages[curPack].append(link) + + # empty packages fix + delete = [] + + for key,value in packages.iteritems(): + if not value: + delete.append(key) + + for key in delete: + del packages[key] + + urls = [] + + for name, links in packages.iteritems(): + if name == "default": + urls.extend(links) + else: + urls.append(Package(name, links)) + + return urls \ No newline at end of file -- cgit v1.2.3 From 4a3a81b63cd85cc3dcd9669868a2079da65838a2 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 3 Jan 2012 20:41:23 +0100 Subject: fixes for old style decrypter --- module/plugins/crypter/LinkList.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/LinkList.py b/module/plugins/crypter/LinkList.py index 8e46f88a9..ebfa373eb 100644 --- a/module/plugins/crypter/LinkList.py +++ b/module/plugins/crypter/LinkList.py @@ -11,6 +11,10 @@ class LinkList(Crypter): __author_name__ = ("spoob", "jeix") __author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com") + # method declaration is needed here + def decryptURL(self, url): + return Crypter.decryptURL(self, url) + def decryptFile(self, content): links = content.splitlines() -- cgit v1.2.3 From 03ec7f017c882c304be1d0759a348d5305f27d42 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Sat, 7 Jan 2012 23:15:49 +0100 Subject: xfilesharengprofolder using new crypter api, allow slash in package name --- module/plugins/crypter/XfilesharingProFolder.py | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 module/plugins/crypter/XfilesharingProFolder.py (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/XfilesharingProFolder.py b/module/plugins/crypter/XfilesharingProFolder.py new file mode 100644 index 000000000..8e58c207d --- /dev/null +++ b/module/plugins/crypter/XfilesharingProFolder.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Crypter import Crypter, Package +import re + +class XfilesharingProFolder(Crypter): + __name__ = "XfilesharingProFolder" + __type__ = "crypter" + __pattern__ = r"http://(?:www\.)?((easybytez|turboupload|uploadville|file4safe|fileband|filebeep|grupload|247upload)\.com|(muchshare|annonhost).net|bzlink.us)/users/.*" + __version__ = "0.01" + __description__ = """Generic XfilesharingPro Folder Plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + LINK_PATTERN = r'' + SUBFOLDER_PATTERN = r'(?!\. \.<)([^<]+)' + + def decryptURL(self, url): + return self.decryptFile(self.load(url, decode = True)) + + def decryptFile(self, html): + new_links = [] + + new_links.extend(re.findall(self.LINK_PATTERN, html)) + + subfolders = re.findall(self.SUBFOLDER_PATTERN, html) + #self.logDebug(subfolders) + for (url, name) in subfolders: + if self.package: name = "%s/%s" % (self.package.name, name) + new_links.append(Package(name, [url])) + + if not new_links: self.fail('Could not extract any links') + + return new_links \ No newline at end of file -- cgit v1.2.3 From c7ad1cc5b4a5d190a060e3ddd9274c3065da6708 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 13 Jan 2012 23:24:21 +0100 Subject: plugin unit test, closed #499, #500 --- module/plugins/crypter/FilesonicComFolder.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/FilesonicComFolder.py b/module/plugins/crypter/FilesonicComFolder.py index b967a74a1..02ae66295 100644 --- a/module/plugins/crypter/FilesonicComFolder.py +++ b/module/plugins/crypter/FilesonicComFolder.py @@ -4,8 +4,6 @@ import re from module.plugins.Crypter import Crypter class FilesonicComFolder(Crypter): - __name__ = "FilesonicComFolder" - __type__ = "crypter" __pattern__ = r"http://(\w*\.)?(sharingmatrix|filesonic|wupload)\.[^/]*/folder/\w+/?" __version__ = "0.11" __description__ = """Filesonic.com/Wupload.com Folder Plugin""" @@ -15,9 +13,8 @@ class FilesonicComFolder(Crypter): FOLDER_PATTERN = r'\s*(.*?)
Files Folder
' LINK_PATTERN = r'' - def decrypt(self, pyfile): - html = self.load(self.pyfile.url) - + def decryptURL(self, url): + html = self.load(url) new_links = [] folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) @@ -26,6 +23,7 @@ class FilesonicComFolder(Crypter): new_links.extend(re.findall(self.LINK_PATTERN, folder.group(1))) if new_links: - self.core.files.addLinks(new_links, self.pyfile.package().id) + return new_links else: - self.fail('Could not extract any links') \ No newline at end of file + self.fail('Could not extract any links') + -- cgit v1.2.3 From 5e5e9b92c5aa4d0fc7a558c06f9137c5edc7bbed Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sat, 4 Feb 2012 18:10:42 +0000 Subject: Update Hotfile and Oron Folder crypters to the new `decryptURL` API. --- module/plugins/crypter/HotfileFolderCom.py | 18 +++++++++++------- module/plugins/crypter/OronComFolder.py | 11 ++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/HotfileFolderCom.py b/module/plugins/crypter/HotfileFolderCom.py index 00771e2a3..ea7311e3c 100644 --- a/module/plugins/crypter/HotfileFolderCom.py +++ b/module/plugins/crypter/HotfileFolderCom.py @@ -9,17 +9,21 @@ class HotfileFolderCom(Crypter): __name__ = "HotfileFolderCom" __type__ = "crypter" __pattern__ = r"http://(?:www\.)?hotfile.com/list/\w+/\w+" - __version__ = "0.1" + __version__ = "0.2" __description__ = """HotfileFolder Download Plugin""" __author_name__ = ("RaNaN") __author_mail__ = ("RaNaN@pyload.org") - def decrypt(self, pyfile): - html = self.load(pyfile.url) + def decryptURL(self, url): + html = self.load(url) - name = re.findall(r'([^<]+)', html, re.MULTILINE)[0].replace("/", "") - new_links = re.findall(r'href="(http://(www.)?hotfile\.com/dl/\d+/[0-9a-zA-Z]+[^"]+)', html) + new_links = [] + for link in re.findall(r'href="(http://(www.)?hotfile\.com/dl/\d+/[0-9a-zA-Z]+[^"]+)', html): + new_links.append(link[0]) - new_links = [x[0] for x in new_links] + if new_links: + self.logDebug("Found %d new links" % len(new_links)) + return new_links + else: + self.fail('Could not extract any links') - self.packages.append((name, new_links, name)) \ No newline at end of file diff --git a/module/plugins/crypter/OronComFolder.py b/module/plugins/crypter/OronComFolder.py index 57b273163..91ac5435f 100755 --- a/module/plugins/crypter/OronComFolder.py +++ b/module/plugins/crypter/OronComFolder.py @@ -8,7 +8,7 @@ class OronComFolder(Crypter): __name__ = "OronComFolder" __type__ = "crypter" __pattern__ = r"http://(?:www\.)?oron.com/folder/\w+" - __version__ = "0.1" + __version__ = "0.2" __description__ = """Oron.com Folder Plugin""" __author_name__ = ("DHMH") __author_mail__ = ("webmaster@pcProfil.de") @@ -16,8 +16,8 @@ class OronComFolder(Crypter): FOLDER_PATTERN = r'(.*)
\n ' LINK_PATTERN = r'
' - def decrypt(self, pyfile): - html = self.load(self.pyfile.url) + def decryptURL(self, url): + html = self.load(url) new_links = [] @@ -27,6 +27,7 @@ class OronComFolder(Crypter): new_links.extend(re.findall(self.LINK_PATTERN, folder.group(0))) if new_links: - self.core.files.addLinks(new_links, self.pyfile.package().id) + self.logDebug("Found %d new links" % len(new_links)) + return new_links else: - self.fail('Could not extract any links') \ No newline at end of file + self.fail('Could not extract any links') -- cgit v1.2.3 From 13c23eb348f9115b2c6b47a579b99d8d1150522b Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 5 Feb 2012 05:16:16 +0000 Subject: Fix OronComFolder regex folder matching. --- module/plugins/crypter/OronComFolder.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/OronComFolder.py b/module/plugins/crypter/OronComFolder.py index 91ac5435f..726371966 100755 --- a/module/plugins/crypter/OronComFolder.py +++ b/module/plugins/crypter/OronComFolder.py @@ -13,7 +13,7 @@ class OronComFolder(Crypter): __author_name__ = ("DHMH") __author_mail__ = ("webmaster@pcProfil.de") - FOLDER_PATTERN = r'(.*)
\n ' + FOLDER_PATTERN = r'(?:.*)(?P.*)(?:.*)' LINK_PATTERN = r'
' def decryptURL(self, url): @@ -21,8 +21,18 @@ class OronComFolder(Crypter): new_links = [] + if 'No such folder exist' in html: + # Don't fail because if there's more than a folder for this package + # and only one of them fails, no urls at all will be added. + self.logWarning("Folder does not exist") + return new_links + folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) - if folder is None: self.fail("Parse error (FOLDER)") + if folder is None: + # Don't fail because if there's more than a folder for this package + # and only one of them fails, no urls at all will be added. + self.logWarning("Parse error (FOLDER)") + return new_links new_links.extend(re.findall(self.LINK_PATTERN, folder.group(0))) @@ -30,4 +40,7 @@ class OronComFolder(Crypter): self.logDebug("Found %d new links" % len(new_links)) return new_links else: - self.fail('Could not extract any links') + # Don't fail because if there's more than a folder for this package + # and only one of them fails, no urls at all will be added. + self.logWarning('Could not extract any links') + return new_links -- cgit v1.2.3