summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-02 22:34:38 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-02 22:34:38 +0100
commit7e759ef2d5dbb30da9752b72146bf4ff240821a8 (patch)
tree9c2829d69bc1092ff44424ac1312005247e935ee /module
parent[Plugin] Improve logging (diff)
downloadpyload-7e759ef2d5dbb30da9752b72146bf4ff240821a8.tar.xz
Update internal XFS plugins
Diffstat (limited to 'module')
-rw-r--r--module/plugins/internal/XFSAccount.py (renamed from module/plugins/internal/XFSPAccount.py)20
-rw-r--r--module/plugins/internal/XFSCrypter.py (renamed from module/plugins/internal/XFSPCrypter.py)13
-rw-r--r--module/plugins/internal/XFSHoster.py (renamed from module/plugins/internal/XFSPHoster.py)36
3 files changed, 36 insertions, 33 deletions
diff --git a/module/plugins/internal/XFSPAccount.py b/module/plugins/internal/XFSAccount.py
index 381e919e6..597964d4c 100644
--- a/module/plugins/internal/XFSPAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -9,12 +9,12 @@ from module.plugins.Account import Account
from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies
-class XFSPAccount(Account):
- __name__ = "XFSPAccount"
+class XFSAccount(Account):
+ __name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.22"
+ __version__ = "0.23"
- __description__ = """XFileSharingPro account plugin"""
+ __description__ = """XFileSharing account plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz"),
("Walter Purcaro", "vuolter@gmail.com")]
@@ -30,9 +30,9 @@ class XFSPAccount(Account):
example: PREMIUM_PATTERN = r'>Renew premium'
"""
- HOSTER_NAME = None
+ HOSTER_DOMAIN = None
- COOKIES = [(HOSTER_NAME, "lang", "english")] #: or list of tuples [(domain, name, value)]
+ COOKIES = [(HOSTER_DOMAIN, "lang", "english")] #: or list of tuples [(domain, name, value)]
VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:.*?(\d{1,2} [\w^_]+ \d{4})'
@@ -44,15 +44,15 @@ class XFSPAccount(Account):
def __init__(self, manager, accounts): #@TODO: remove in 0.4.10
self.init()
- return super(XFSPAccount, self).__init__(manager, accounts)
+ return super(XFSAccount, self).__init__(manager, accounts)
def init(self):
- # if not self.HOSTER_NAME:
- # self.fail(_("Missing HOSTER_NAME"))
+ # if not self.HOSTER_DOMAIN:
+ # self.fail(_("Missing HOSTER_DOMAIN"))
if not hasattr(self, "HOSTER_URL"):
- self.HOSTER_URL = "http://www.%s/" % self.HOSTER_NAME.replace("www.", "", 1)
+ self.HOSTER_URL = "http://www.%s/" % self.HOSTER_DOMAIN.replace("www.", "", 1)
def loadAccountInfo(self, user, req):
diff --git a/module/plugins/internal/XFSPCrypter.py b/module/plugins/internal/XFSCrypter.py
index 378b78d02..5a126707b 100644
--- a/module/plugins/internal/XFSPCrypter.py
+++ b/module/plugins/internal/XFSCrypter.py
@@ -3,26 +3,27 @@
from module.plugins.internal.SimpleCrypter import SimpleCrypter
-class XFSPCrypter(SimpleCrypter):
- __name__ = "XFSPCrypter"
+class XFSCrypter(SimpleCrypter):
+ __name__ = "XFSCrypter"
__type__ = "crypter"
- __version__ = "0.02"
+ __version__ = "0.03"
__pattern__ = None
- __description__ = """XFileSharingPro decrypter plugin"""
+ __description__ = """XFileSharing decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
+ HOSTER_DOMAIN = None
HOSTER_NAME = None
URL_REPLACEMENTS = [(r'[?/&]+$', r''), (r'(.+/[^?]*)$', r'\1?'), (r'$', r'&per_page=10000')]
- COOKIES = [(HOSTER_NAME, "lang", "english")]
+ COOKIES = [(HOSTER_DOMAIN, "lang", "english")]
LINK_PATTERN = r'<(?:td|TD) [^>]*>\s*<a href="(.+?)"[^>]*>.+?(?:</a>)?\s*</(?:td|TD)>'
- TITLE_PATTERN = r'<[tT]itle>.*?\: (.+) folder</[tT]itle>'
+ NAME_PATTERN = r'<[tT]itle>.*?\: (.+) folder</[tT]itle>'
OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)'
TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)'
diff --git a/module/plugins/internal/XFSPHoster.py b/module/plugins/internal/XFSHoster.py
index 72a4a9d8c..b7a407a19 100644
--- a/module/plugins/internal/XFSPHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -11,29 +11,28 @@ from module.plugins.Plugin import Fail
from module.utils import html_unescape
-class XFSPHoster(SimpleHoster):
- __name__ = "XFSPHoster"
+class XFSHoster(SimpleHoster):
+ __name__ = "XFSHoster"
__type__ = "hoster"
- __version__ = "0.07"
+ __version__ = "0.08"
__pattern__ = None
- __description__ = """XFileSharingPro hoster plugin"""
+ __description__ = """XFileSharing hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz"),
("stickell", "l.stickell@yahoo.it"),
("Walter Purcaro", "vuolter@gmail.com")]
+ HOSTER_DOMAIN = None
HOSTER_NAME = None
- FILE_URL_REPLACEMENTS = []
+ COOKIES = [(HOSTER_DOMAIN, "lang", "english")]
- COOKIES = [(HOSTER_NAME, "lang", "english")]
-
- FILE_INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>'
- FILE_NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"'
- FILE_SIZE_PATTERN = r'You have requested .*\((?P<S>[\d\.\,]+) ?(?P<U>[\w^_]+)?\)</font>'
+ INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>'
+ NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"'
+ SIZE_PATTERN = r'You have requested .*\((?P<S>[\d\.\,]+) ?(?P<U>[\w^_]+)?\)</font>'
OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)'
TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)'
@@ -58,18 +57,21 @@ class XFSPHoster(SimpleHoster):
def prepare(self):
""" Initialize important variables """
+ if not self.HOSTER_DOMAIN:
+ self.fail(_("Missing HOSTER_DOMAIN"))
+
if not self.HOSTER_NAME:
- self.fail(_("Missing HOSTER_NAME"))
+ self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')])
if not self.LINK_PATTERN:
pattern = r'(https?://(www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<]'
- self.LINK_PATTERN = pattern % self.HOSTER_NAME
+ self.LINK_PATTERN = pattern % self.HOSTER_DOMAIN.replace('.', '\.')
self.captcha = None
self.errmsg = None
self.passwords = self.getPassword().splitlines()
- return super(XFSPHoster, self).prepare()
+ return super(XFSHoster, self).prepare()
def handleFree(self):
@@ -127,7 +129,7 @@ class XFSPHoster(SimpleHoster):
inputs['url_mass'] = self.pyfile.url
inputs['up1oad_type'] = 'url'
- self.logDebug(self.HOSTER_NAME, action, inputs)
+ self.logDebug(action, inputs)
#wait for file to upload to easybytez.com
self.req.http.c.setopt(LOW_SPEED_TIME, 600)
self.html = self.load(action, post=inputs)
@@ -135,7 +137,7 @@ class XFSPHoster(SimpleHoster):
action, inputs = self.parseHtmlForm('F1')
if not inputs:
self.error(_("TEXTAREA not found"))
- self.logDebug(self.HOSTER_NAME, inputs)
+ self.logDebug(inputs)
if inputs['st'] == 'OK':
self.html = self.load(action, post=inputs)
elif inputs['st'] == 'Can not leech file':
@@ -212,7 +214,7 @@ class XFSPHoster(SimpleHoster):
else:
self.error(_("Form not found"))
- self.logDebug(self.HOSTER_NAME, inputs)
+ self.logDebug(inputs)
if 'op' in inputs and inputs['op'] in ("download2", "download3"):
if "password" in inputs:
@@ -269,7 +271,7 @@ class XFSPHoster(SimpleHoster):
self.logDebug(captcha_div)
numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
- self.logDebug("CAPTCHA", inputs['code'], numerals)
+ self.logDebug("Captcha code: %s" % inputs['code'], numerals)
return 2
recaptcha = ReCaptcha(self)