summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/ExtabitCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/ExtabitCom.py')
-rw-r--r--module/plugins/hoster/ExtabitCom.py44
1 files changed, 23 insertions, 21 deletions
diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py
index 2409d8517..fc38a79a9 100644
--- a/module/plugins/hoster/ExtabitCom.py
+++ b/module/plugins/hoster/ExtabitCom.py
@@ -10,67 +10,69 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ExtabitCom(SimpleHoster):
- __name__ = "ExtabitCom"
- __type__ = "hoster"
- __version__ = "0.6"
+ __name__ = "ExtabitCom"
+ __type__ = "hoster"
+ __version__ = "0.62"
__pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)'
__description__ = """Extabit.com hoster plugin"""
- __author_name__ = "zoidberg"
- __author_mail__ = "zoidberg@mujmail.cz"
+ __license__ = "GPLv3"
+ __authors__ = [("zoidberg", "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>'
+
+ NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>[^"]+)">'
+ SIZE_PATTERN = r'<th>Size:</th>\s*<td class="col-fileinfo">(?P<S>[^<]+)</td>'
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]+/.*?)[\'"]'
+ LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]'
def handleFree(self):
if r">Only premium users can download this file" in self.html:
- self.fail("Only premium users can download this file")
+ self.fail(_("Only premium users can download this file"))
m = re.search(r"Next free download from your ip will be available in <b>(\d+)\s*minutes", self.html)
if m:
self.wait(int(m.group(1)) * 60, True)
elif "The daily downloads limit from your IP is exceeded" in self.html:
- self.logWarning("You have reached your daily downloads limit for today")
+ 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)
- fileID = m.group('ID') if m else self.file_info('ID')
+ fileID = m.group('ID') if m else self.info('ID')
m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html)
if m:
recaptcha = ReCaptcha(self)
captcha_key = m.group(1)
- for _ in xrange(5):
+ for _i in xrange(5):
get_data = {"type": "recaptcha"}
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:
+ res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data))
+ if "ok" in res:
self.correctCaptcha()
break
else:
self.invalidCaptcha()
else:
- self.fail("Invalid captcha")
+ self.fail(_("Invalid captcha"))
else:
- self.parseError('Captcha')
+ self.error(_("Captcha"))
+
+ if not "href" in res:
+ self.error(_("Bad JSON response"))
- if not "href" in response:
- self.parseError('JSON')
+ self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href']))
- self.html = self.load("http://extabit.com/file/%s%s" % (fileID, response['href']))
m = re.search(self.LINK_PATTERN, self.html)
if m is None:
- self.parseError('Download URL')
+ self.error(_("LINK_PATTERN not found"))
+
url = m.group(1)
- self.logDebug("Download URL: " + url)
self.download(url)