diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-06 01:38:05 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-06 01:38:05 +0100 |
commit | 2c38c50e936b203183013b7be9907375801b5d3f (patch) | |
tree | 08a459a5f44ff476ec4c28332aeffd31a0ee02c5 /module | |
parent | Code cosmetics about checkErrors (diff) | |
download | pyload-2c38c50e936b203183013b7be9907375801b5d3f.tar.xz |
[DebridItaliaCom] Updated
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/DebridItaliaCom.py | 30 | ||||
-rw-r--r-- | module/plugins/hooks/DebridItaliaCom.py | 17 | ||||
-rw-r--r-- | module/plugins/hoster/DebridItaliaCom.py | 37 |
3 files changed, 45 insertions, 39 deletions
diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index f5a536004..e9d4964cc 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- import re -import time + +from time import mktime, strptime from module.plugins.Account import Account @@ -9,32 +10,35 @@ from module.plugins.Account import Account class DebridItaliaCom(Account): __name__ = "DebridItaliaCom" __type__ = "account" - __version__ = "0.1" + __version__ = "0.11" __description__ = """Debriditalia.com account plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] - WALID_UNTIL_PATTERN = r'Premium valid till: (?P<D>[^|]+) \|' + WALID_UNTIL_PATTERN = r'Premium valid till: (.+?) \|' def loadAccountInfo(self, user, req): + info = {"premium": False, "validuntil": None, "trafficleft": None} html = req.load("http://debriditalia.com/") - if 'Account premium not activated' in html: - return {"premium": False, "validuntil": None, "trafficleft": None} + if 'Account premium not activated' not in html: + m = re.search(self.WALID_UNTIL_PATTERN, html) + if m: + validuntil = int(mktime(strptime(m.group(1), "%d/%m/%Y %H:%M"))) + info = {"premium": True, "validuntil": validuntil, "trafficleft": -1} + else: + self.logError(_("Unable to retrieve account information")) - m = re.search(self.WALID_UNTIL_PATTERN, html) - if m: - validuntil = int(time.mktime(time.strptime(m.group('D'), "%d/%m/%Y %H:%M"))) - return {"premium": True, "validuntil": validuntil, "trafficleft": -1} - else: - self.logError(_("Unable to retrieve account information")) + return info def login(self, user, data, req): html = req.load("http://debriditalia.com/login.php", - get={"u": user, "p": data['password']}) + get={'u': user, 'p': data['password']}) + if 'NO' in html: self.wrongPassword() diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py index 86d37b3bd..b7f0ef1c7 100644 --- a/module/plugins/hooks/DebridItaliaCom.py +++ b/module/plugins/hooks/DebridItaliaCom.py @@ -1,12 +1,15 @@ # -*- coding: utf-8 -*- +import re + +from module.network.RequestFactory import getURL from module.plugins.internal.MultiHoster import MultiHoster class DebridItaliaCom(MultiHoster): __name__ = "DebridItaliaCom" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), @@ -15,14 +18,10 @@ class DebridItaliaCom(MultiHoster): __description__ = """Debriditalia.com hook plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] def getHoster(self): - return ["netload.in", "hotfile.com", "rapidshare.com", "multiupload.com", - "uploading.com", "megashares.com", "crocko.com", "filepost.com", - "bitshare.com", "share-links.biz", "putlocker.com", "uploaded.to", - "speedload.org", "rapidgator.net", "likeupload.net", "cyberlocker.ch", - "depositfiles.com", "extabit.com", "filefactory.com", "sharefiles.co", - "ryushare.com", "tusfiles.net", "nowvideo.co", "cloudzer.net", "letitbit.net", - "easybytez.com", "uptobox.com", "ddlstorage.com"] + html = getURL("http://www.debriditalia.com/status.php") + return re.findall(r'title="(.+?)"> \1</td><td><img src="/images/(?:attivo|testing)', html) diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index dbac000c8..90f1233ff 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -3,48 +3,51 @@ import re from module.plugins.Hoster import Hoster +from module.plugins.internal.SimpleHoster import replace_patterns class DebridItaliaCom(Hoster): __name__ = "DebridItaliaCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" - __pattern__ = r'https?://(?:[^/]*\.)?debriditalia\.com' + __pattern__ = r'http://s\d+\.debriditalia\.com/dl/\d+' __description__ = """Debriditalia.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + URL_REPLACEMENTS = [(r'(/dl/\d+)$', '\1/')] def setup(self): - self.chunkLimit = -1 + self.chunkLimit = -1 self.resumeDownload = True def process(self, pyfile): + pyfile.url = replace_patterns(pyfile.url, cls.URL_REPLACEMENTS) + if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url + link = pyfile.url + elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "DebridItalia") self.fail(_("No DebridItalia account provided")) + else: - self.logDebug("Old URL: %s" % pyfile.url) - url = "http://debriditalia.com/linkgen2.php?xjxfun=convertiLink&xjxargs[]=S<![CDATA[%s]]>" % pyfile.url - page = self.load(url) - self.logDebug("XML data: %s" % page) + html = self.load("http://www.debriditalia.com/api.php?generate=&link=%s" % pyfile.url) - if 'File not available' in page: - self.fail(_("File not available")) - else: - new_url = re.search(r'<a href="(?:[^"]+)">(?P<direct>[^<]+)</a>', page).group('direct') + if "ERROR" in html: + self.fail(re.search(r'ERROR:(.*)', html).split()) - if new_url != pyfile.url: - self.logDebug("New URL: %s" % new_url) + link = html.split() - self.download(new_url, disposition=True) + self.download(link, disposition=True) - check = self.checkDownload({"empty": re.compile(r"^$")}) + check = self.checkDownload({'empty': re.compile(r"^$")}) if check == "empty": self.retry(5, 2 * 60, "Empty file downloaded") |