diff options
Diffstat (limited to 'module/plugins/hoster/ExtabitCom.py')
-rw-r--r-- | module/plugins/hoster/ExtabitCom.py | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 4dba81a8f..2409d8517 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -1,44 +1,32 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. - - @author: zoidberg -""" - import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.CaptchaService import ReCaptcha from module.common.json_layer import json_loads +from module.plugins.hoster.UnrestrictLi import secondsToMidnight +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" + __version__ = "0.6" + __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' - __version__ = "0.5" + __description__ = """Extabit.com hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" FILE_NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>[^"]+)">' FILE_SIZE_PATTERN = r'<th>Size:</th>\s*<td class="col-fileinfo">(?P<S>[^<]+)</td>' - FILE_OFFLINE_PATTERN = r'>File not found<' - TEMP_OFFLINE_PATTERN = r">(File is temporary unavailable|No download mirror)<" + OFFLINE_PATTERN = r'>File not found<' + TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' + + LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/[a-z0-9]+/.*?)[\'"]' - DOWNLOAD_LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/[a-z0-9]+/.*?)[\'"]' def handleFree(self): if r">Only premium users can download this file" in self.html: @@ -48,7 +36,8 @@ class ExtabitCom(SimpleHoster): if m: self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.html: - self.wait(1 * 60 * 60, True) + self.logWarning("You have reached your daily downloads limit for today") + self.wait(secondsToMidnight(gmt=2), True) self.logDebug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) @@ -61,7 +50,7 @@ class ExtabitCom(SimpleHoster): for _ in xrange(5): get_data = {"type": "recaptcha"} - get_data["challenge"], get_data["capture"] = recaptcha.challenge(captcha_key) + get_data['challenge'], get_data['capture'] = recaptcha.challenge(captcha_key) response = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) if "ok" in response: self.correctCaptcha() @@ -77,8 +66,8 @@ class ExtabitCom(SimpleHoster): self.parseError('JSON') self.html = self.load("http://extabit.com/file/%s%s" % (fileID, response['href'])) - m = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) - if not m: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.parseError('Download URL') url = m.group(1) self.logDebug("Download URL: " + url) |