From ce1c2b6b05c08b669357947e61ae40efce7fc50f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 16 Feb 2015 10:46:28 +0100 Subject: module temp --- module/plugins/hoster/DataportCz.py | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 module/plugins/hoster/DataportCz.py (limited to 'module/plugins/hoster/DataportCz.py') diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py new file mode 100644 index 000000000..d06207257 --- /dev/null +++ b/module/plugins/hoster/DataportCz.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class DataportCz(SimpleHoster): + __name__ = "DataportCz" + __type__ = "hoster" + __version__ = "0.40" + + __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.*)' + + __description__ = """Dataport.cz hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'(?P[^<]+)' + SIZE_PATTERN = r'Velikost\s*(?P[^<]+)' + OFFLINE_PATTERN = r'

Soubor nebyl nalezen

' + + CAPTCHA_PATTERN = r'
\s*(\d+)
' + + + def handleFree(self): + captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} + + for _i in xrange(60): + action, inputs = self.parseHtmlForm('free_download_form') + self.logDebug(action, inputs) + if not action or not inputs: + self.error(_("free_download_form")) + + if "captchaId" in inputs and inputs['captchaId'] in captchas: + inputs['captchaCode'] = captchas[inputs['captchaId']] + else: + self.error(_("captcha")) + + self.html = self.download("http://www.dataport.cz%s" % action, post=inputs) + + check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', + "slot": 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) + if check == "captcha": + self.error(_("invalid captcha")) + elif check == "slot": + self.logDebug("No free slots - wait 60s and retry") + self.wait(60, False) + self.html = self.load(self.pyfile.url, decode=True) + continue + else: + break + + +getInfo = create_getInfo(DataportCz) -- cgit v1.2.3