summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-03-07 20:17:29 +0100
committerGravatar Stefano <l.stickell@yahoo.it> 2013-03-07 20:17:29 +0100
commit02e6b873ad9971d4974a5b4f7a126dee3da60d2c (patch)
tree881795ef7532f26baf3296c024f0b58342665147 /module/plugins
parentMerge pull request #34 from stickell/fixes (diff)
downloadpyload-02e6b873ad9971d4974a5b4f7a126dee3da60d2c.tar.xz
SpeedLoadOrgFolder: crypter rewritten
Trivial changes to the SimpleCrypter class
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/crypter/SpeedLoadOrgFolder.py43
-rw-r--r--module/plugins/internal/SimpleCrypter.py9
2 files changed, 9 insertions, 43 deletions
diff --git a/module/plugins/crypter/SpeedLoadOrgFolder.py b/module/plugins/crypter/SpeedLoadOrgFolder.py
index 002605233..a4a3e99e3 100644
--- a/module/plugins/crypter/SpeedLoadOrgFolder.py
+++ b/module/plugins/crypter/SpeedLoadOrgFolder.py
@@ -1,47 +1,14 @@
# -*- coding: utf-8 -*-
-from module.plugins.Crypter import Crypter
-import re
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
-class SpeedLoadOrgFolder(Crypter):
+class SpeedLoadOrgFolder(SimpleCrypter):
__name__ = "SpeedLoadOrgFolder"
__type__ = "crypter"
- __pattern__ = r"http://(www\.)?speedload\.org/(?P<ID>\w+)~f$"
- __version__ = "0.1"
+ __pattern__ = r"http://(www\.)?speedload\.org/(\d+~f$|folder/\d+/)"
+ __version__ = "0.2"
__description__ = """Speedload Crypter Plugin"""
__author_name__ = ("stickell")
__author_mail__ = ("l.stickell@yahoo.it")
- def decrypt(self, pyfile):
- self.html = self.load(pyfile.url)
- (package_name, folder_name) = self.getPackageNameAndFolder()
- package_links = self.getLinks()
-
- self.packages = [(package_name, package_links, folder_name)]
-
- def getPackageNameAndFolder(self):
- title_re = r"Files Within Folder '(?P<title>.+)'"
- m = re.search(title_re, self.html)
- if m is not None:
- name = folder = m.group('title')
- self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder))
- return name, folder
- else:
- name = self.pyfile.package().name
- folder = self.pyfile.package().folder
- self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
- return name, folder
-
- def getLinks(self):
- pages = int(re.search('Total Pages (\d)', self.html).group(1))
-
- link_regex = re.compile('<a href="(http://speedload.org/\w+)"')
- links = link_regex.findall(self.html)
-
- if pages > 1:
- for p in range(2, pages + 1):
- self.html = self.load(self.pyfile.url + '?page=%d' % p)
- links += link_regex.findall(self.html)
-
- self.logDebug("Package has %d links" % len(links))
- return links
+ LINK_PATTERN = r'<div class="link"><a href="(http://speedload.org/\w+)"'
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 69798bc0a..b4f4230a1 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -17,12 +17,12 @@
@author: zoidberg
"""
-from re import findall
+import re
from module.plugins.Crypter import Crypter
class SimpleCrypter(Crypter):
__name__ = "SimpleCrypter"
- __version__ = "0.01"
+ __version__ = "0.02"
__pattern__ = None
__type__ = "crypter"
__description__ = """Base crypter plugin"""
@@ -35,10 +35,9 @@ class SimpleCrypter(Crypter):
def decrypt(self, pyfile):
self.html = self.load(self.url)
- new_links = []
- new_links.extend(findall(self.LINK_PATTERN, self.html))
+ new_links = re.findall(self.LINK_PATTERN, self.html)
if new_links:
self.core.files.addLinks(new_links, self.pyfile.package().id)
else:
- self.fail('Could not extract any links') \ No newline at end of file
+ self.fail('Could not extract any links')