diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-07 19:54:24 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-07 19:54:24 +0200 |
commit | be459e0b409dcd5e04edd75be374bd35d4018e9a (patch) | |
tree | 3f73e813d20608ff0d23eada8214a5124c85bff5 /pyload/plugins/internal | |
parent | Merge branch 'stable' into 0.4.10 (diff) | |
parent | New __authors__ key replaces __author_name__ and __author_mail__ + Whitespace... (diff) | |
download | pyload-be459e0b409dcd5e04edd75be374bd35d4018e9a.tar.xz |
Merge branch 'stable' into 0.4.10
Conflicts:
module/plugins/internal/CaptchaService.py
pyload/plugins/account/EasybytezCom.py
pyload/plugins/account/TusfilesNet.py
pyload/plugins/base/OCR.py
pyload/plugins/crypter/MultiuploadCom.py
pyload/plugins/crypter/UploadableChFolder.py
pyload/plugins/hoster/DuploadOrg.py
pyload/plugins/hoster/EpicShareNet.py
pyload/plugins/hoster/LemUploadsCom.py
pyload/plugins/hoster/LoadTo.py
pyload/plugins/hoster/LomafileCom.py
pyload/plugins/hoster/MegaFilesSe.py
pyload/plugins/hoster/MegareleaseOrg.py
pyload/plugins/hoster/PandaPlanet.py
pyload/plugins/hoster/PotloadCom.py
pyload/plugins/hoster/PremiumTo.py
pyload/plugins/hoster/TurbobitNet.py
pyload/plugins/internal/DeadCrypter.py
pyload/plugins/internal/DeadHoster.py
pyload/plugins/internal/SimpleCrypter.py
pyload/plugins/internal/UpdateManager.py
pyload/plugins/ocr/LinksaveIn.py
Diffstat (limited to 'pyload/plugins/internal')
-rw-r--r-- | pyload/plugins/internal/AbstractExtractor.py | 3 | ||||
-rw-r--r-- | pyload/plugins/internal/DeadCrypter.py | 3 | ||||
-rw-r--r-- | pyload/plugins/internal/DeadHoster.py | 3 | ||||
-rw-r--r-- | pyload/plugins/internal/MultiHoster.py | 4 | ||||
-rw-r--r-- | pyload/plugins/internal/SimpleCrypter.py | 43 | ||||
-rw-r--r-- | pyload/plugins/internal/SimpleHoster.py | 52 | ||||
-rw-r--r-- | pyload/plugins/internal/UnRar.py | 3 | ||||
-rw-r--r-- | pyload/plugins/internal/UnZip.py | 3 | ||||
-rw-r--r-- | pyload/plugins/internal/UpdateManager.py | 3 | ||||
-rw-r--r-- | pyload/plugins/internal/XFSPAccount.py | 73 | ||||
-rw-r--r-- | pyload/plugins/internal/XFSPHoster.py | 7 |
11 files changed, 127 insertions, 70 deletions
diff --git a/pyload/plugins/internal/AbstractExtractor.py b/pyload/plugins/internal/AbstractExtractor.py index 39bc46b1e..5a372fd71 100644 --- a/pyload/plugins/internal/AbstractExtractor.py +++ b/pyload/plugins/internal/AbstractExtractor.py @@ -17,8 +17,7 @@ class AbtractExtractor: __version__ = "0.1" __description__ = """Abtract extractor plugin""" - __author_name__ = "pyLoad Team" - __author_mail__ = "admin@pyload.org" + __authors__ = [("pyLoad Team", "admin@pyload.org")] @staticmethod diff --git a/pyload/plugins/internal/DeadCrypter.py b/pyload/plugins/internal/DeadCrypter.py index 2d4dfc7e6..9a59677fd 100644 --- a/pyload/plugins/internal/DeadCrypter.py +++ b/pyload/plugins/internal/DeadCrypter.py @@ -11,8 +11,7 @@ class DeadCrypter(_Crypter): __pattern__ = None __description__ = """Crypter is no longer available""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def setup(self): diff --git a/pyload/plugins/internal/DeadHoster.py b/pyload/plugins/internal/DeadHoster.py index 72fd356bd..349296e47 100644 --- a/pyload/plugins/internal/DeadHoster.py +++ b/pyload/plugins/internal/DeadHoster.py @@ -19,8 +19,7 @@ class DeadHoster(_Hoster): __pattern__ = None __description__ = """Hoster is no longer available""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def setup(self): diff --git a/pyload/plugins/internal/MultiHoster.py b/pyload/plugins/internal/MultiHoster.py index 1781cb17f..087edb6af 100644 --- a/pyload/plugins/internal/MultiHoster.py +++ b/pyload/plugins/internal/MultiHoster.py @@ -12,8 +12,8 @@ class MultiHoster(Addon): __version__ = "0.20" __description__ = """Generic MultiHoster plugin""" - __author_name__ = "pyLoad Team" - __author_mail__ = "admin@pyload.org" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + replacements = [("2shared.com", "twoshared.com"), ("4shared.com", "fourshared.com"), ("cloudnator.com", "shragle.com"), ("ifile.it", "filecloud.io"), ("easy-share.com", "crocko.com"), ("freakshare.net", "freakshare.com"), diff --git a/pyload/plugins/internal/SimpleCrypter.py b/pyload/plugins/internal/SimpleCrypter.py index 454a95e84..6c5c9593f 100644 --- a/pyload/plugins/internal/SimpleCrypter.py +++ b/pyload/plugins/internal/SimpleCrypter.py @@ -2,30 +2,32 @@ import re -from pyload.plugins.base.Crypter import Crypter +from pyload.plugins.Crypter import Crypter from pyload.plugins.internal.SimpleHoster import PluginParseError, replace_patterns, set_cookies -from pyload.utils import html_unescape +from pyload.utils import fixup, html_unescape class SimpleCrypter(Crypter): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.12" + __version__ = "0.13" __pattern__ = None __description__ = """Simple decrypter plugin""" - __author_name__ = ("stickell", "zoidberg", "Walter Purcaro") - __author_mail__ = ("l.stickell@yahoo.it", "zoidberg@mujmail.cz", "vuolter@gmail.com") + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + """ 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+)' + example: LINK_PATTERN = r'<div class="link"><a href="(.+?)"' - TITLE_PATTERN: (optional) The group defined by 'title' should be the folder name or the webpage title - example: TITLE_PATTERN = r'<title>Files of: (?P<title>[^<]+) folder</title>' + TITLE_PATTERN: (optional) group(1) should be the folder name or the webpage title + example: TITLE_PATTERN = r'<title>Files of: ([^<]+) folder</title>' OFFLINE_PATTERN: (optional) Checks if the file is yet available online example: OFFLINE_PATTERN = r'File (deleted|not found)' @@ -39,8 +41,8 @@ class SimpleCrypter(Crypter): If the links are splitted on multiple pages you can define the PAGES_PATTERN regex: - PAGES_PATTERN: (optional) The group defined by 'pages' should be the number of overall pages containing the links - example: PAGES_PATTERN = r'Pages: (?P<pages>\d+)' + PAGES_PATTERN: (optional) group(1) should be the number of overall pages containing the links + example: PAGES_PATTERN = r'Pages: (\d+)' and its loadPage method: @@ -48,7 +50,7 @@ class SimpleCrypter(Crypter): return the html of the page number page_n """ - + TITLE_REPLACEMENTS = [("&#?\w+;", fixup)] URL_REPLACEMENTS = [] TEXT_ENCODING = False #: Set to True or encoding name if encoding in http header is not correct @@ -110,23 +112,28 @@ class SimpleCrypter(Crypter): def getPackageNameAndFolder(self): if hasattr(self, 'TITLE_PATTERN'): - m = re.search(self.TITLE_PATTERN, self.html) - if m: - name = folder = html_unescape(m.group('title').strip()) + try: + m = re.search(self.TITLE_PATTERN, self.html) + name = replace_patterns(m.group(1).strip(), self.TITLE_REPLACEMENTS) + folder = html_unescape(name) + except: + pass + else: self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) return name, folder 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 handleMultiPages(self): - pages = re.search(self.PAGES_PATTERN, self.html) - if pages: - pages = int(pages.group('pages')) - else: + try: + m = re.search(self.PAGES_PATTERN, self.html) + pages = int(m.group(1)) + except: pages = 1 for p in xrange(2, pages + 1): diff --git a/pyload/plugins/internal/SimpleHoster.py b/pyload/plugins/internal/SimpleHoster.py index 8fdff5dd5..bc4cc3c88 100644 --- a/pyload/plugins/internal/SimpleHoster.py +++ b/pyload/plugins/internal/SimpleHoster.py @@ -106,15 +106,14 @@ def parseFileInfo(self, url='', html=''): # File online, return name and size info['status'] = 2 if 'N' in info: - info['name'] = replace_patterns(info['N'], self.FILE_NAME_REPLACEMENTS) + info['name'] = replace_patterns(info['N'].strip(), self.FILE_NAME_REPLACEMENTS) if 'S' in info: size = replace_patterns(info['S'] + info['U'] if 'U' in info else info['S'], self.FILE_SIZE_REPLACEMENTS) info['size'] = parseFileSize(size) elif isinstance(info['size'], basestring): - if 'units' in info: - info['size'] += info['units'] - info['size'] = parseFileSize(info['size']) + unit = info['units'] if 'units' in info else None + info['size'] = parseFileSize(info['size'], unit) if hasattr(self, "file_info"): self.file_info = info @@ -153,13 +152,15 @@ class PluginParseError(Exception): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.36" + __version__ = "0.38" __pattern__ = None __description__ = """Simple hoster plugin""" - __author_name__ = ("zoidberg", "stickell", "Walter Purcaro") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it", "vuolter@gmail.com") + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + """ Following patterns should be defined by each hoster: @@ -180,6 +181,15 @@ class SimpleHoster(Hoster): PREMIUM_ONLY_PATTERN: (optional) Checks if the file can be downloaded only with a premium account example: PREMIUM_ONLY_PATTERN = r'Premium account required' + + + Instead overriding handleFree and handlePremium methods now you can define patterns for direct download: + + LINK_FREE_PATTERN: (optional) group(1) should be the direct link for free download + example: LINK_FREE_PATTERN = r'<div class="link"><a href="(.+?)"' + + LINK_PREMIUM_PATTERN: (optional) group(1) should be the direct link for premium download + example: LINK_PREMIUM_PATTERN = r'<div class="link"><a href="(.+?)"' """ FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup)] @@ -255,11 +265,35 @@ class SimpleHoster(Hoster): def handleFree(self): - self.fail("Free download not implemented") + if not hasattr(self, 'LINK_FREE_PATTERN'): + self.fail("Free download not implemented") + + try: + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.parseError("Free download link not found") + + link = m.group(1) + except Exception, e: + self.logError(str(e)) + else: + self.download(link, ref=True, cookies=True, disposition=True) def handlePremium(self): - self.fail("Premium download not implemented") + if not hasattr(self, 'LINK_PREMIUM_PATTERN'): + self.fail("Premium download not implemented") + + try: + m = re.search(self.LINK_PREMIUM_PATTERN, self.html) + if m is None: + self.parseError("Premium download link not found") + + link = m.group(1) + except Exception, e: + self.logError(str(e)) + else: + self.download(link, ref=True, cookies=True, disposition=True) def parseError(self, msg): diff --git a/pyload/plugins/internal/UnRar.py b/pyload/plugins/internal/UnRar.py index 0f54e75b9..df7557d0d 100644 --- a/pyload/plugins/internal/UnRar.py +++ b/pyload/plugins/internal/UnRar.py @@ -25,8 +25,7 @@ class UnRar(AbtractExtractor): __version__ = "0.18" __description__ = """Rar extractor plugin""" - __author_name__ = "RaNaN" - __author_mail__ = "RaNaN@pyload.org" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] CMD = "unrar" diff --git a/pyload/plugins/internal/UnZip.py b/pyload/plugins/internal/UnZip.py index 65a5a82bb..0fe50198f 100644 --- a/pyload/plugins/internal/UnZip.py +++ b/pyload/plugins/internal/UnZip.py @@ -11,8 +11,7 @@ class UnZip(AbtractExtractor): __version__ = "0.1" __description__ = """Zip extractor plugin""" - __author_name__ = "RaNaN" - __author_mail__ = "RaNaN@pyload.org" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] @staticmethod diff --git a/pyload/plugins/internal/UpdateManager.py b/pyload/plugins/internal/UpdateManager.py index 7848fa2de..f64a1e573 100644 --- a/pyload/plugins/internal/UpdateManager.py +++ b/pyload/plugins/internal/UpdateManager.py @@ -23,8 +23,7 @@ class UpdateManager(Addon): ("nodebugupdate", "bool", "Don't check for updates in debug mode", True)] __description__ = """Check for updates""" - __author_name__ = "Walter Purcaro" - __author_mail__ = "vuolter@gmail.com" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] event_list = ["pluginConfigChanged"] diff --git a/pyload/plugins/internal/XFSPAccount.py b/pyload/plugins/internal/XFSPAccount.py index 058fdf2b5..edf6ad3cc 100644 --- a/pyload/plugins/internal/XFSPAccount.py +++ b/pyload/plugins/internal/XFSPAccount.py @@ -2,6 +2,7 @@ import re +from urlparse import urljoin from time import mktime, strptime from pyload.plugins.base.Account import Account @@ -12,62 +13,82 @@ from pyload.utils import parseFileSize class XFSPAccount(Account): __name__ = "XFSPAccount" __type__ = "account" - __version__ = "0.07" + __version__ = "0.09" __description__ = """XFileSharingPro base account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] HOSTER_URL = None COOKIES = None #: or list of tuples [(domain, name, value)] - VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:</TD><TD><b>([^<]+)</b>' - TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><b>([^<]+)</b>' - LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|>Error<' - PREMIUM_PATTERN = r'>Renew premium<' + VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:.*?<b>(.+?)</b>' + TRAFFIC_LEFT_PATTERN = r'>Traffic available today:.*?<b>(?P<S>.+?)</b>' + LOGIN_FAIL_PATTERN = r'>(Incorrect Login or Password|Error<)' + # PREMIUM_PATTERN = r'>Renew premium<' def loadAccountInfo(self, user, req): - html = req.load(self.HOSTER_URL + "?op=my_account", decode=True) + html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) - validuntil = trafficleft = None - premium = True if re.search(self.PREMIUM_PATTERN, html) else False + validuntil = None + trafficleft = None + premium = None + + if hasattr(self, "PREMIUM_PATTERN"): + premium = True if re.search(self.PREMIUM_PATTERN, html) else False m = re.search(self.VALID_UNTIL_PATTERN, html) if m: - premium = True - trafficleft = -1 + expiredate = m.group(1) + self.logDebug("Expire date: " + expiredate) + try: - self.logDebug(m.group(1)) - validuntil = mktime(strptime(m.group(1), "%d %B %Y")) + validuntil = mktime(strptime(expiredate, "%d %B %Y")) except Exception, e: self.logError(e) - else: - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = m.group(1) - if "Unlimited" in trafficleft: + else: + if validuntil > mktime(gmtime()): premium = True + trafficleft = -1 else: - trafficleft = parseFileSize(trafficleft) / 1024 + if premium is False: #: registered account type (not premium) + validuntil = -1 + premium = False + + try: + traffic = re.search(self.TRAFFIC_LEFT_PATTERN, html).groupdict() + trafficsize = traffic['S'] + traffic['U'] if 'U' in traffic else traffic['S'] + if "Unlimited" in trafficsize: + trafficleft = -1 + if premium is None: + premium = True + else: + trafficleft = parseFileSize(trafficsize) + except: + pass + + if premium is None: + premium = False - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} def login(self, user, data, req): set_cookies(req.cj, self.COOKIES) - html = req.load('%slogin.html' % self.HOSTER_URL, decode=True) + url = urljoin(self.HOSTER_URL, "login.html") + html = req.load(url, decode=True) action, inputs = parseHtmlForm('name="FL"', html) if not inputs: - inputs = {"op": "login", - "redirect": self.HOSTER_URL} + inputs = {'op': "login", + 'redirect': self.HOSTER_URL} - inputs.update({"login": user, - "password": data['password']}) + inputs.update({'login': user, + 'password': data['password']}) html = req.load(self.HOSTER_URL, post=inputs, decode=True) diff --git a/pyload/plugins/internal/XFSPHoster.py b/pyload/plugins/internal/XFSPHoster.py index 3adae43c5..ae8065732 100644 --- a/pyload/plugins/internal/XFSPHoster.py +++ b/pyload/plugins/internal/XFSPHoster.py @@ -26,8 +26,9 @@ class XFSPHoster(SimpleHoster): __pattern__ = r'^unmatchable$' __description__ = """XFileSharingPro base hoster plugin""" - __author_name__ = ("zoidberg", "stickell", "Walter Purcaro") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it", "vuolter@gmail.com") + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] HOSTER_NAME = None @@ -242,7 +243,7 @@ class XFSPHoster(SimpleHoster): self.retry(25) elif 'countdown' in self.errmsg or 'Expired' in self.errmsg: self.retry() - elif 'maintenance' in self.errmsg: + elif 'maintenance' in self.errmsg or 'maintainance' in self.errmsg: self.tempOffline() elif 'download files up to' in self.errmsg: self.fail("File too large for free download") |