diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-13 15:56:57 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-13 15:56:57 +0100 |
commit | acc46fc3497a66a427b795b4a22c6e71d69185a1 (patch) | |
tree | 2d315b838a76435fc456b972c99c28d1732b2f70 /pyload/plugin/hoster/LuckyShareNet.py | |
parent | Code fixes (diff) | |
download | pyload-acc46fc3497a66a427b795b4a22c6e71d69185a1.tar.xz |
Update
Diffstat (limited to 'pyload/plugin/hoster/LuckyShareNet.py')
-rw-r--r-- | pyload/plugin/hoster/LuckyShareNet.py | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/pyload/plugin/hoster/LuckyShareNet.py b/pyload/plugin/hoster/LuckyShareNet.py new file mode 100644 index 000000000..8f0843529 --- /dev/null +++ b/pyload/plugin/hoster/LuckyShareNet.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +import re + +from bottle import json_loads + +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class LuckyShareNet(SimpleHoster): + __name = "LuckyShareNet" + __type = "hoster" + __version = "0.04" + + __pattern = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' + + __description = """LuckyShare.net hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] + + + INFO_PATTERN = r'<h1 class=\'file_name\'>(?P<N>\S+)</h1>\s*<span class=\'file_size\'>Filesize: (?P<S>[\d.,]+)(?P<U>[\w^_]+)</span>' + OFFLINE_PATTERN = r'There is no such file available' + + + def parseJson(self, rep): + if 'AJAX Error' in rep: + html = self.load(self.pyfile.url, decode=True) + m = re.search(r"waitingtime = (\d+);", html) + if m: + seconds = int(m.group(1)) + self.logDebug("You have to wait %d seconds between free downloads" % seconds) + self.retry(wait_time=seconds) + else: + self.error(_("Unable to detect wait time between free downloads")) + elif 'Hash expired' in rep: + self.retry(reason=_("Hash expired")) + return json_loads(rep) + + + # TODO: There should be a filesize limit for free downloads + # TODO: Some files could not be downloaded in free mode + def handleFree(self): + rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID'], decode=True) + self.logDebug("JSON: " + rep) + json = self.parseJson(rep) + + self.wait(int(json['time'])) + + recaptcha = ReCaptcha(self) + + for _i in xrange(5): + challenge, response = recaptcha.challenge() + rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % + (challenge, response, json['hash']), decode=True) + self.logDebug("JSON: " + rep) + if 'link' in rep: + json.update(self.parseJson(rep)) + self.correctCaptcha() + break + elif 'Verification failed' in rep: + self.invalidCaptcha() + else: + self.error(_("Unable to get downlaod link")) + + if not json['link']: + self.fail(_("No Download url retrieved/all captcha attempts failed")) + + self.download(json['link']) + + +getInfo = create_getInfo(LuckyShareNet) |