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.py39
1 files changed, 10 insertions, 29 deletions
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index 6d5641778..62afb6c7c 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -7,12 +7,11 @@
# http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html
import re
-
-from urlparse import urljoin
+import urlparse
from module.common.json_layer import json_loads, json_dumps
from module.network.RequestFactory import getURL
-from module.plugins.internal.CaptchaService import ReCaptcha
+from module.plugins.internal.ReCaptcha import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, secondsToMidnight
@@ -36,9 +35,10 @@ def getInfo(urls):
class LetitbitNet(SimpleHoster):
__name__ = "LetitbitNet"
__type__ = "hoster"
- __version__ = "0.29"
+ __version__ = "0.31"
__pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """Letitbit.net hoster plugin"""
__license__ = "GPLv3"
@@ -56,16 +56,6 @@ class LetitbitNet(SimpleHoster):
self.resumeDownload = True
- def getFileInfo(self):
- api_rep = api_response(self.pyfile.url)
- if api_rep['status'] == 'OK':
- self.api_data = api_rep['data'][0]
- self.pyfile.name = self.api_data['name']
- self.pyfile.size = self.api_data['size']
- else:
- self.offline()
-
-
def handleFree(self, pyfile):
action, inputs = self.parseHtmlForm('id="ifree_form"')
if not action:
@@ -75,7 +65,7 @@ class LetitbitNet(SimpleHoster):
self.logDebug(action, inputs)
inputs['desc'] = ""
- self.html = self.load(urljoin("http://letitbit.net/", action), post=inputs, cookies=True)
+ self.html = self.load(urlparse.urljoin("http://letitbit.net/", action), post=inputs)
m = re.search(self.SECONDS_PATTERN, self.html)
seconds = int(m.group(1)) if m else 60
@@ -89,14 +79,14 @@ class LetitbitNet(SimpleHoster):
self.wait(seconds)
- res = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True)
+ res = self.load("http://letitbit.net/ajax/download3.php", post=" ")
if res != '1':
self.error(_("Unknown response - ajax_check_url"))
self.logDebug(res)
recaptcha = ReCaptcha(self)
- challenge, response = recaptcha.challenge()
+ response, challenge = recaptcha.challenge()
post_data = {"recaptcha_challenge_field": challenge,
"recaptcha_response_field": response,
@@ -104,7 +94,7 @@ class LetitbitNet(SimpleHoster):
self.logDebug("Post data to send", post_data)
- res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True)
+ res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data)
self.logDebug(res)
@@ -128,16 +118,7 @@ class LetitbitNet(SimpleHoster):
else:
self.error(_("Unknown response - captcha check"))
- self.correctCaptcha()
-
- for download_url in urls:
- try:
- self.download(download_url)
- break
- except Exception, e:
- self.logError(e)
- else:
- self.fail(_("Download did not finish correctly"))
+ self.link = urls[0]
def handlePremium(self, pyfile):
@@ -152,4 +133,4 @@ class LetitbitNet(SimpleHoster):
if api_rep['status'] == 'FAIL':
self.fail(api_rep['data'])
- self.download(api_rep['data'][0][0], disposition=True)
+ self.link = api_rep['data'][0][0]