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/OronComFolder.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'module/plugins/crypter/OronComFolder.py') 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/OronComFolder.py') 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