diff options
Diffstat (limited to 'pyload/plugins/hoster/DateiTo.py')
-rw-r--r-- | pyload/plugins/hoster/DateiTo.py | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/pyload/plugins/hoster/DateiTo.py b/pyload/plugins/hoster/DateiTo.py index 4a00f22aa..2f83960e6 100644 --- a/pyload/plugins/hoster/DateiTo.py +++ b/pyload/plugins/hoster/DateiTo.py @@ -7,18 +7,19 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): - __name__ = "DateiTo" - __type__ = "hoster" - __version__ = "0.02" + __name__ = "DateiTo" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' __description__ = """Datei.to hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'Dateiname:</td>\s*<td colspan="2"><strong>(?P<N>.*?)</' - FILE_SIZE_PATTERN = r'Dateigröße:</td>\s*<td colspan="2">(?P<S>.*?)</' + NAME_PATTERN = r'Dateiname:</td>\s*<td colspan="2"><strong>(?P<N>.*?)</' + SIZE_PATTERN = r'Dateigröße:</td>\s*<td colspan="2">(?P<S>.*?)</' OFFLINE_PATTERN = r'>Datei wurde nicht gefunden<|>Bitte wähle deine Datei aus... <' PARALELL_PATTERN = r'>Du lädst bereits eine Datei herunter<' @@ -28,11 +29,10 @@ class DateiTo(SimpleHoster): def handleFree(self): url = 'http://datei.to/ajax/download.php' - data = {'P': 'I', 'ID': self.file_info['ID']} - + data = {'P': 'I', 'ID': self.info['ID']} recaptcha = ReCaptcha(self) - for _ in xrange(10): + for _i in xrange(10): self.logDebug("URL", url, "POST", data) self.html = self.load(url, post=data) self.checkErrors() @@ -46,38 +46,33 @@ class DateiTo(SimpleHoster): m = re.search(self.DATA_PATTERN, self.html) if m is None: - self.parseError('data') + self.error(_("data")) url = 'http://datei.to/' + m.group(1) data = dict(x.split('=') for x in m.group(2).split('&')) if url.endswith('recaptcha.php'): - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha key not found") - - data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(captcha_key) - + data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge() else: - self.fail('Too bad...') + self.fail(_("Too bad...")) download_url = self.html - self.logDebug("Download URL", download_url) self.download(download_url) + def checkErrors(self): m = re.search(self.PARALELL_PATTERN, self.html) if m: m = re.search(self.WAIT_PATTERN, self.html) wait_time = int(m.group(1)) if m else 30 - self.wait(wait_time + 1, False) - self.retry() + self.retry(wait_time=wait_time) + def doWait(self): m = re.search(self.WAIT_PATTERN, self.html) wait_time = int(m.group(1)) if m else 30 self.load('http://datei.to/ajax/download.php', post={'P': 'Ads'}) - self.wait(wait_time + 1, False) + self.wait(wait_time, False) getInfo = create_getInfo(DateiTo) |