summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/LetitbitNet.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/LetitbitNet.py')
-rw-r--r--module/plugins/hoster/LetitbitNet.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index 475f0931b..aed35e71b 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -19,12 +19,13 @@
import re
from random import random
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.common.json_layer import json_loads
class LetitbitNet(SimpleHoster):
__name__ = "LetitbitNet"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*letitbit.net/download/.*"
- __version__ = "0.14"
+ __version__ = "0.15"
__description__ = """letitbit.net"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
@@ -61,21 +62,36 @@ class LetitbitNet(SimpleHoster):
self.parseError("page 3 / js")
response = self.load(ajax_check_url, post = inputs, cookies = True)
- if response != '1': self.fail('Unknown response (ajax_check_url)')
+ if response != '1': self.parseError('Unknown response - ajax_check_url')
for i in range(5):
captcha = self.decryptCaptcha('%s/captcha_new.php?rand=%d' % (captcha_url, random() * 100000), cookies = True)
response = self.load(captcha_url + '/ajax/check_captcha.php', post = {"code": captcha}, cookies = True)
self.logDebug(response)
- if response.startswith('http://'):
- download_url = response
- self.correctCaptcha()
+ if not response:
+ self.invalidCaptcha()
+ elif response.startswith('['):
+ urls = json_loads(response)
+ break
+ elif response.startswith('http://'):
+ urls = [response]
break
else:
- self.invalidCaptcha()
+ self.parseError("Unknown response - captcha check")
+
else:
self.fail("No valid captcha solution received")
- self.download(download_url)
+ self.correctCaptcha()
+
+ for download_url in urls:
+ try:
+ self.logDebug("Download URL", download_url)
+ self.download(download_url)
+ break
+ except Exception, e:
+ self.logError(e)
+ else:
+ self.fail("Download did not finish correctly")
getInfo = create_getInfo(LetitbitNet) \ No newline at end of file