From eb61d1bb0a30fd32f99b93f847346c610fbc91d2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 15 Nov 2014 07:26:01 +0100 Subject: Update plugins after merging --- pyload/plugins/hoster/MegaRapidCz.py | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 pyload/plugins/hoster/MegaRapidCz.py (limited to 'pyload/plugins/hoster/MegaRapidCz.py') diff --git a/pyload/plugins/hoster/MegaRapidCz.py b/pyload/plugins/hoster/MegaRapidCz.py new file mode 100644 index 000000000..f49d0e1ec --- /dev/null +++ b/pyload/plugins/hoster/MegaRapidCz.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +import re + +from pycurl import HTTPHEADER + +from pyload.network.RequestFactory import getRequest +from pyload.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo + + +def getInfo(urls): + h = getRequest() + h.c.setopt(HTTPHEADER, + ["Accept: text/html", + "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"]) + + for url in urls: + html = h.load(url, decode=True) + yield parseFileInfo(MegaRapidCz, url, html) + + +class MegaRapidCz(SimpleHoster): + __name__ = "MegaRapidCz" + __type__ = "hoster" + __version__ = "0.54" + + __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' + + __description__ = """MegaRapid.cz hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("MikyWoW", "mikywow@seznam.cz"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r']*>]*>(?:]*>)?(?P[^<]+)' + SIZE_PATTERN = r'Velikost:\s*\s*(?P[\d.,]+) (?P[\w^_]+)' + OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' + + FORCE_CHECK_TRAFFIC = True + + LINK_PATTERN = r'([^<]+)' + ERR_LOGIN_PATTERN = ur'
Stahování je přístupné pouze přihlášeným uživatelům' + ERR_CREDIT_PATTERN = ur'
Stahování zdarma je možné jen přes náš' + + + def setup(self): + self.chunkLimit = 1 + + + def handlePremium(self): + try: + self.html = self.load(self.pyfile.url, decode=True) + except BadHeader, e: + self.account.relogin(self.user) + self.retry(wait_time=60, reason=str(e)) + + m = re.search(self.LINK_PATTERN, self.html) + if m: + link = m.group(1) + self.logDebug("Premium link: %s" % link) + self.download(link, disposition=True) + else: + if re.search(self.ERR_LOGIN_PATTERN, self.html): + self.relogin(self.user) + self.retry(wait_time=60, reason=_("User login failed")) + elif re.search(self.ERR_CREDIT_PATTERN, self.html): + self.fail(_("Not enough credit left")) + else: + self.fail(_("Download link not found")) -- cgit v1.2.3