diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-08-12 00:38:07 +0200 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-08-12 00:38:07 +0200 |
commit | 3e16daf0a12fc43c2087300a02560879688c7f18 (patch) | |
tree | 7f940496596d888056efeb1794d9f9b29296b36a /module/plugins | |
parent | coolshare.cz + warserver.cz premium support (diff) | |
download | pyload-3e16daf0a12fc43c2087300a02560879688c7f18.tar.xz |
update depositfiles, easybytes, add ryushare
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/RyushareCom.py | 12 | ||||
-rw-r--r-- | module/plugins/hoster/DepositfilesCom.py | 8 | ||||
-rw-r--r-- | module/plugins/hoster/EasybytezCom.py | 8 | ||||
-rw-r--r-- | module/plugins/hoster/RyushareCom.py | 16 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 15 | ||||
-rw-r--r-- | module/plugins/internal/XFSPAccount.py | 44 |
6 files changed, 77 insertions, 26 deletions
diff --git a/module/plugins/accounts/RyushareCom.py b/module/plugins/accounts/RyushareCom.py new file mode 100644 index 000000000..8eb0d3571 --- /dev/null +++ b/module/plugins/accounts/RyushareCom.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class RyushareCom(XFSPAccount): + __name__ = "RyushareCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """ryushare.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + MAIN_PAGE = "http://ryushare.com/"
\ No newline at end of file diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 9ff6b0b55..9c13a5f3a 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -11,15 +11,17 @@ class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?depositfiles\.com(/\w{1,3})?/files/[\w]+" - __version__ = "0.41" + __version__ = "0.42" __description__ = """Depositfiles.com Download Hoster""" __author_name__ = ("spoob", "zoidberg") __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") FILE_NAME_PATTERN = r'File name: <b title="(?P<N>[^"]+)' FILE_SIZE_PATTERN = r'File size: <b>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</b>' + FILE_INFO_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\'' FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>' FILE_URL_REPLACEMENTS = [(r"\.com(/.*?)?/files", ".com/en/files"), (r"\.html$", "")] + FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )] RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'" DOWNLOAD_LINK_PATTERN = r'<form action="(http://.+?\.depositfiles.com/.+?)" method="get"' @@ -92,7 +94,7 @@ class DepositfilesCom(SimpleHoster): self.fail('No valid captcha response received') try: - self.download(link) + self.download(link, disposition = True) except: self.retry(wait_time = 60) @@ -105,6 +107,6 @@ class DepositfilesCom(SimpleHoster): self.retry() link = unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1)) self.multiDL = True - self.download(link) + self.download(link, disposition = True) getInfo = create_getInfo(DepositfilesCom)
\ No newline at end of file diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index 5b9925e97..d69b9bfa5 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -24,7 +24,7 @@ class EasybytezCom(XFileSharingPro): __name__ = "EasybytezCom" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)?easybytez.com/(\w+).*" - __version__ = "0.09" + __version__ = "0.10" __description__ = """easybytez.com""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") @@ -49,7 +49,7 @@ class EasybytezCom(XFileSharingPro): self.startDownload(found.group(1)) def handleOverriden(self): - self.html = self.load(self.HOSTER_NAME) + self.html = self.load("http://www.%s/" % self.HOSTER_NAME) action, inputs = self.parseHtmlForm('') upload_id = "%012d" % int(random()*10**12) action += upload_id + "&js_on=1&utype=prem&upload_type=url" @@ -60,8 +60,8 @@ class EasybytezCom(XFileSharingPro): self.logDebug(action, inputs) self.html = self.load(action, post = inputs) - action, inputs = self.parseHtmlForm('name="F1"') - if not inputs: parseError('TEXTAREA') + action, inputs = self.parseHtmlForm('F1') + if not inputs: self.parseError('TEXTAREA') self.logDebug(inputs) if inputs['st'] == 'OK': self.html = self.load(action, post = inputs) diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py new file mode 100644 index 000000000..97a14242c --- /dev/null +++ b/module/plugins/hoster/RyushareCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class RyushareCom(XFileSharingPro): + __name__ = "RyushareCom" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)*?ryushare.com/\w{12}" + __version__ = "0.01" + __description__ = """ryushare.com hoster plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def setup(self): + self.resumeDownload = self.multiDL = self.premium + +getInfo = create_getInfo(RyushareCom)
\ No newline at end of file diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 09b496aa9..566615120 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -40,18 +40,23 @@ def set_cookies(cj, cookies): def parseHtmlTagAttrValue(attr_name, tag): m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^\s\"'][^>\s]+)\1" % attr_name, tag) - return m.group(2) if m else '' - + return m.group(2) if m else None + def parseHtmlForm(attr_str, html): inputs = {} action = None form = re.search(r"(?P<tag><form[^>]*%s[^>]*>)(?P<content>.*?)</(form|body|html)[^>]*>" % attr_str, html, re.S | re.I) if form: action = parseHtmlTagAttrValue("action", form.group('tag')) - for input in re.finditer(r'(<(?:input|textarea)[^>]*>)', form.group('content'), re.S | re.I): + for input in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('content'), re.S | re.I): name = parseHtmlTagAttrValue("name", input.group(1)) if name: - inputs[name] = parseHtmlTagAttrValue("value", input.group(1)) + value = parseHtmlTagAttrValue("value", input.group(1)) + if value is None: + inputs[name] = input.group(3) or '' + else: + inputs[name] = value + return action, inputs def parseFileInfo(self, url = '', html = ''): @@ -124,7 +129,7 @@ class PluginParseError(Exception): class SimpleHoster(Hoster): __name__ = "SimpleHoster" - __version__ = "0.24" + __version__ = "0.25" __pattern__ = None __type__ = "hoster" __description__ = """Base hoster plugin""" diff --git a/module/plugins/internal/XFSPAccount.py b/module/plugins/internal/XFSPAccount.py index f187109b7..76bbfb9fe 100644 --- a/module/plugins/internal/XFSPAccount.py +++ b/module/plugins/internal/XFSPAccount.py @@ -20,10 +20,12 @@ import re from time import mktime, strptime from module.plugins.Account import Account +from module.plugins.internal.SimpleHoster import parseHtmlForm +from module.utils import parseFileSize class XFSPAccount(Account): __name__ = "XFSPAccount" - __version__ = "0.01" + __version__ = "0.03" __type__ = "account" __description__ = """XFileSharingPro account base""" __author_name__ = ("zoidberg") @@ -33,33 +35,47 @@ class XFSPAccount(Account): VALID_UNTIL_PATTERN = r'<TR><TD>Premium account expire:</TD><TD><b>([^<]+)</b>' TRAFFIC_LEFT_PATTERN = r'<TR><TD>Traffic available today:</TD><TD><b>(?P<S>[^<]+)</b>' - - def loadAccountInfo(self, user, req): + + def loadAccountInfo(self, user, req): html = req.load(self.MAIN_PAGE + "?op=my_account", decode = True) - validuntil = -1 + validuntil = trafficleft = None + premium = True if '>Renew premium<' in html else False + found = re.search(self.VALID_UNTIL_PATTERN, html) if found: premium = True + trafficleft = -1 try: self.logDebug(found.group(1)) validuntil = mktime(strptime(found.group(1), "%d %B %Y")) except Exception, e: self.logError(e) else: - premium = False - - trafficleft = -1 + found = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if found: + trafficleft = found.group(1) + if "Unlimited" in trafficleft: + premium = True + else: + trafficleft = parseFileSize(trafficleft) / 1024 return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) def login(self, user, data, req): - html = req.load(self.MAIN_PAGE, post = { - "login": user, - "op": "login", - "password": data['password'], - "redirect": self.MAIN_PAGE - }, decode = True) + html = req.load('%slogin.html' % self.MAIN_PAGE, decode = True) + + action, inputs = parseHtmlForm('name="FL"', html) + if not action: + action = self.MAIN_PAGE + if not inputs: + inputs = {"op": "login", + "redirect": self.MAIN_PAGE} + + inputs.update({"login": user, + "password": data['password']}) + + html = req.load(action, post = inputs, decode = True) - if 'Incorrect Login or Password' in html: + if 'Incorrect Login or Password' in html or '>Error<' in html: self.wrongPassword()
\ No newline at end of file |