summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/internal
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-20 22:03:34 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-20 22:03:34 +0200
commit4aa8241528f997509282bd9c8edbc83d7096d66a (patch)
tree45148d014c8129c8cd1f2935adf49f9725280948 /pyload/plugins/internal
parentadded missing init file (diff)
parentUsing the same translatable string (diff)
downloadpyload-4aa8241528f997509282bd9c8edbc83d7096d66a.tar.xz
Merge plugins from stable
Conflicts: module/plugins/hoster/UnrestrictLi.py pyload/plugins/hooks/Captcha9kw.py pyload/plugins/hoster/AlldebridCom.py pyload/plugins/hoster/BitshareCom.py pyload/plugins/hoster/EgoFilesCom.py pyload/plugins/hoster/FreakshareCom.py pyload/plugins/hoster/LuckyShareNet.py pyload/plugins/hoster/Premium4Me.py pyload/plugins/hoster/PremiumizeMe.py pyload/plugins/hoster/RapidshareCom.py pyload/plugins/hoster/RealdebridCom.py pyload/plugins/hoster/ShareplaceCom.py pyload/plugins/hoster/UploadedTo.py pyload/plugins/hoster/UploadingCom.py pyload/plugins/hoster/Xdcc.py pyload/plugins/hoster/YourfilesTo.py pyload/plugins/hoster/ZeveraCom.py
Diffstat (limited to 'pyload/plugins/internal')
-rw-r--r--pyload/plugins/internal/SimpleCrypter.py34
1 files changed, 29 insertions, 5 deletions
diff --git a/pyload/plugins/internal/SimpleCrypter.py b/pyload/plugins/internal/SimpleCrypter.py
index d935bf1da..546b920e0 100644
--- a/pyload/plugins/internal/SimpleCrypter.py
+++ b/pyload/plugins/internal/SimpleCrypter.py
@@ -25,7 +25,7 @@ from module.utils import html_unescape
class SimpleCrypter(Crypter):
__name__ = "SimpleCrypter"
- __version__ = "0.04"
+ __version__ = "0.05"
__pattern__ = None
__type__ = "crypter"
__description__ = """Base crypter plugin"""
@@ -39,6 +39,15 @@ class SimpleCrypter(Crypter):
TITLE_PATTERN: (optional) the group defined by 'title' should be the title
example: <title>Files of: (?P<title>[^<]+) folder</title>
+
+ If the links are disposed on multiple pages you need to define a pattern:
+
+ PAGES_PATTERN: the group defined by 'pages' must be the total number of pages
+
+ and a function:
+
+ loadPage(self, page_n):
+ must return the html of the page number 'page_n'
"""
def decrypt(self, pyfile):
@@ -46,11 +55,15 @@ class SimpleCrypter(Crypter):
package_name, folder_name = self.getPackageNameAndFolder()
- package_links = re.findall(self.LINK_PATTERN, self.html)
- self.logDebug('Package has %d links' % len(package_links))
+ self.package_links = re.findall(self.LINK_PATTERN, self.html)
+
+ if hasattr(self, 'PAGES_PATTERN') and hasattr(self, 'loadPage'):
+ self.handleMultiPages()
- if package_links:
- self.packages = [(package_name, package_links, folder_name)]
+ self.logDebug('Package has %d links' % len(self.package_links))
+
+ if self.package_links:
+ self.packages = [(package_name, self.package_links, folder_name)]
else:
self.fail('Could not extract any links')
@@ -66,3 +79,14 @@ class SimpleCrypter(Crypter):
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 handleMultiPages(self):
+ pages = re.search(self.PAGES_PATTERN, self.html)
+ if pages:
+ pages = int(pages.group('pages'))
+ else:
+ pages = 1
+
+ for p in range(2, pages + 1):
+ self.html = self.loadPage(p)
+ self.package_links += re.findall(self.LINK_PATTERN, self.html)