summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/crypter/EasybytezComFolder.py4
-rw-r--r--module/plugins/crypter/TusfilesNetFolder.py4
-rw-r--r--module/plugins/internal/SimpleCrypter.py40
3 files changed, 33 insertions, 15 deletions
diff --git a/module/plugins/crypter/EasybytezComFolder.py b/module/plugins/crypter/EasybytezComFolder.py
index b4a6284fc..7a8ee5424 100644
--- a/module/plugins/crypter/EasybytezComFolder.py
+++ b/module/plugins/crypter/EasybytezComFolder.py
@@ -21,12 +21,12 @@ class EasybytezComFolder(SimpleCrypter):
__name__ = "EasybytezComFolder"
__type__ = "crypter"
__pattern__ = r'http://(?:www\.)?easybytez\.com/users/(?P<ID>\d+/\d+)'
- __version__ = "0.05"
+ __version__ = "0.06"
__description__ = """Easybytez.com decrypter plugin"""
__author_name__ = "stickell"
__author_mail__ = "l.stickell@yahoo.it"
- FILE_URL_REPLACEMENTS = [(__pattern__, r"http://www.easybytez.com/users/\g<ID>?per_page=10000")]
+ URL_REPLACEMENTS = [(__pattern__, r"http://www.easybytez.com/users/\g<ID>?per_page=10000")]
LINK_PATTERN = r'<td><a href="(http://www\.easybytez\.com/\w+)" target="_blank">.+(?:</a>)?</td>'
TITLE_PATTERN = r'<Title>Files of \d+: (?P<title>.+) folder</Title>'
diff --git a/module/plugins/crypter/TusfilesNetFolder.py b/module/plugins/crypter/TusfilesNetFolder.py
index 0bc770f99..5ee32379d 100644
--- a/module/plugins/crypter/TusfilesNetFolder.py
+++ b/module/plugins/crypter/TusfilesNetFolder.py
@@ -27,7 +27,7 @@ class TusfilesNetFolder(SimpleCrypter):
__name__ = "TusfilesNetFolder"
__type__ = "crypter"
__pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)/?'
- __version__ = "0.01"
+ __version__ = "0.02"
__description__ = """Tusfiles.net folder decrypter plugin"""
__author_name__ = ("Walter Purcaro", "stickell")
__author_mail__ = ("vuolter@gmail.com", "l.stickell@yahoo.it")
@@ -36,7 +36,7 @@ class TusfilesNetFolder(SimpleCrypter):
TITLE_PATTERN = r'<Title>.*?\: (?P<title>.+) folder</Title>'
PAGES_PATTERN = r'>\((?P<pages>\d+) \w+\)<'
- FILE_URL_REPLACEMENTS = [(__pattern__, r'https://www.tusfiles.net/go/\g<ID>/')]
+ URL_REPLACEMENTS = [(__pattern__, r'https://www.tusfiles.net/go/\g<ID>/')]
def loadPage(self, page_n):
return self.load(urljoin(self.pyfile.url, str(page_n)), decode=True)
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 268efee86..2c024d738 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -26,34 +26,44 @@ from module.plugins.internal.SimpleHoster import replace_patterns, set_cookies
class SimpleCrypter(Crypter):
__name__ = "SimpleCrypter"
- __version__ = "0.08"
+ __version__ = "0.09"
__pattern__ = None
__type__ = "crypter"
__description__ = """Simple decrypter plugin"""
__author_name__ = ("stickell", "zoidberg")
__author_mail__ = ("l.stickell@yahoo.it", "zoidberg@mujmail.cz")
+
"""
- These patterns should be defined by each crypter:
+ Following patterns should be defined by each crypter:
+
+ LINK_PATTERN: group(1) must be a download link or a regex to catch more links
+ example: LINK_PATTERN = r'<div class="link"><a href="(http://speedload.org/\w+)'
+
+ TITLE_PATTERN: (optional) The group defined by 'title' should be the title
+ example: TITLE_PATTERN = r'<title>Files of: (?P<title>[^<]+) folder</title>'
+
+ OFFLINE_PATTERN: (optional) Checks if the file is yet available online
+ example: OFFLINE_PATTERN = r'File (deleted|not found)'
- LINK_PATTERN: group(1) must be a download link
- example: <div class="link"><a href="(http://speedload.org/\w+)
+ TEMP_OFFLINE_PATTERN: (optional) Checks if the file is temporarily offline
+ example: TEMP_OFFLINE_PATTERN = r'Server maintainance'
- TITLE_PATTERN: (optional) the group defined by 'title' should be the title
- example: <title>Files of: (?P<title>[^<]+) folder</title>
If it's impossible to extract the links using the LINK_PATTERN only you can override the getLinks method.
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
+ PAGES_PATTERN: The group defined by 'pages' must be the total number of pages
+ example: PAGES_PATTERN = r''
and a function:
- loadPage(self, page_n):
- must return the html of the page number 'page_n'
+ loadPage(self, page_n):
+ return the html of the page number 'page_n'
"""
- FILE_URL_REPLACEMENTS = []
+ URL_REPLACEMENTS = []
+
SH_COOKIES = True # or False or list of tuples [(domain, name, value)]
@@ -62,10 +72,12 @@ class SimpleCrypter(Crypter):
set_cookies(self.req.cj, self.SH_COOKIES)
def decrypt(self, pyfile):
- pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS)
+ pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS)
self.html = self.load(pyfile.url, decode=True)
+ self.checkOnline()
+
package_name, folder_name = self.getPackageNameAndFolder()
self.package_links = self.getLinks()
@@ -87,6 +99,12 @@ class SimpleCrypter(Crypter):
"""
return re.findall(self.LINK_PATTERN, self.html)
+ def checkOnline(self):
+ if hasattr(self, "OFFLINE_PATTERN") and re.search(self.OFFLINE_PATTERN, self.html):
+ self.offline()
+ elif hasattr(self, "TEMP_OFFLINE_PATTERN") and re.search(self.TEMP_OFFLINE_PATTERN, self.html):
+ self.tempOffline()
+
def getPackageNameAndFolder(self):
if hasattr(self, 'TITLE_PATTERN'):
m = re.search(self.TITLE_PATTERN, self.html)