diff options
-rw-r--r-- | module/plugins/accounts/NitroflareCom.py | 55 | ||||
-rw-r--r-- | module/plugins/accounts/RapidgatorNet.py | 20 | ||||
-rw-r--r-- | module/plugins/accounts/UploadedTo.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/NitroflareCom.py | 18 | ||||
-rw-r--r-- | module/plugins/hoster/OneFichierCom.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/RapidgatorNet.py | 14 | ||||
-rw-r--r-- | module/plugins/internal/Account.py | 6 |
7 files changed, 84 insertions, 37 deletions
diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py index cc0ce3ea9..7ffcd172d 100644 --- a/module/plugins/accounts/NitroflareCom.py +++ b/module/plugins/accounts/NitroflareCom.py @@ -4,24 +4,27 @@ import re import time from module.plugins.internal.Account import Account +from module.PyFile import PyFile +from module.plugins.captcha.ReCaptcha import ReCaptcha class NitroflareCom(Account): __name__ = "NitroflareCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.15" __status__ = "testing" __description__ = """Nitroflare.com account plugin""" __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com" ), + ("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] VALID_UNTIL_PATTERN = r'>Time Left</label><strong>(.+?)</' - TRAFFIC_LEFT_PATTERN = r'>Daily Limit</label><strong>([\d.,]+)' + TRAFFIC_LEFT_PATTERN = r'>Your Daily Limit</label><strong>(?P<S1>[\d.,]+) (?P<U1>[\w^_]+ )?/ (?P<S2>[\d.,]+) (?P<U2>[\w^_]+)' LOGIN_FAIL_PATTERN = r'<ul class="errors">\s*<li>' - TOKEN_PATTERN = r'name="token" value="(.+?)"' + TOKEN_PATTERN = r'name="token" value="(.+?)"' def grab_info(self, user, password, data): @@ -56,7 +59,7 @@ class NitroflareCom(Account): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m is not None: try: - trafficleft = self.parse_traffic(str(max(0, 50 - float(m.group(1)))), "GB") + trafficleft = self.parse_traffic(m.group('S2'), m.group('U2')) - self.parse_traffic(m.group('S1'), m.group('U1') or "B") except Exception, e: self.log_error(e, trace=True) @@ -69,15 +72,41 @@ class NitroflareCom(Account): def signin(self, user, password, data): - html = self.load("https://nitroflare.com/login") + login_url = "https://nitroflare.com/login" + post_data = {'login' : "", + 'email' : user, + 'password': password} - token = re.search(self.TOKEN_PATTERN, html).group(1) + self.data = self.load(login_url) - html = self.load("https://nitroflare.com/login", - post={'login' : "", - 'email' : user, - 'password': password, - 'token' : token}) + # dummy pyfile + pyfile = PyFile(self.pyload.files, -1, login_url, login_url, 0, 0, "", self.classname, -1, -1) + pyfile.plugin = self - if re.search(self.LOGIN_FAIL_PATTERN, html): + self.captcha = ReCaptcha(pyfile) + + captcha_key = self.captcha.detect_key() + if captcha_key: + response, challenge = self.captcha.challenge() + post_data['g-recaptcha-response'] = response + + token = re.search(self.TOKEN_PATTERN, self.data).group(1) + post_data['token'] = token + + self.data = self.load("https://nitroflare.com/login", post=post_data) + + if re.search(self.LOGIN_FAIL_PATTERN, self.data): self.fail_login() + + """ + @NOTE: below are methods + necessary for captcha to work with account plugins + """ + def check_status(self): + pass + + def retry_captcha(self, attemps=10, wait=1, msg=_("Max captcha retries reached")): + self.captcha.invalid() + self.fail_login(msg="Invalid captcha") + + diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 3fb2cf928..701997480 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -9,14 +9,17 @@ from module.plugins.internal.misc import json class RapidgatorNet(Account): __name__ = "RapidgatorNet" __type__ = "account" - __version__ = "0.18" + __version__ = "0.21" __status__ = "testing" __description__ = """Rapidgator.net account plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __authors__ = [("zoidberg", "zoidberg@mujmail.cz" ), + ("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] + TUNE_TIMEOUT = False + API_URL = "http://rapidgator.net/api/user/" @@ -37,12 +40,10 @@ class RapidgatorNet(Account): json_data = json.loads(html) if json_data['response_status'] == 200: - if "reset_in" in json_data['response']: - self._schedule_refresh(user, json_data['response']['reset_in']) - validuntil = json_data['response']['expire_date'] trafficleft = float(json_data['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 premium = True + else: self.log_error(json_data['response_details']) @@ -67,7 +68,16 @@ class RapidgatorNet(Account): if json_data['response_status'] == 200: data['sid'] = str(json_data['response']['session_id']) + + if 'reset_in' in json_data['response']: + self.timeout = float(json_data['response']['reset_in']) + self.TUNE_TIMEOUT = False + + else: + self.TUNE_TIMEOUT = True + return + else: self.log_error(json_data['response_details']) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index c46a6de13..50c03041d 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class UploadedTo(Account): __name__ = "UploadedTo" __type__ = "account" - __version__ = "0.41" + __version__ = "0.42" __status__ = "testing" __description__ = """Uploaded.to account plugin""" @@ -20,7 +20,7 @@ class UploadedTo(Account): COOKIES = False PREMIUM_PATTERN = r'<em>Premium</em>' - VALID_UNTIL_PATTERN = r'<td>Duration:</td>\s*<th>(.+?)<' + VALID_UNTIL_PATTERN = r'<td>Duration:</td>\s*<th>\s*(.+?)<' TRAFFIC_LEFT_PATTERN = r'<b class="cB">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index 3e2970985..e08c0e603 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class NitroflareCom(SimpleHoster): __name__ = "NitroflareCom" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.21" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' @@ -23,7 +23,8 @@ class NitroflareCom(SimpleHoster): __license__ = "GPLv3" __authors__ = [("sahil" , "sahilshekhawat01@gmail.com"), ("Walter Purcaro", "vuolter@gmail.com" ), - ("Stickell" , "l.stickell@yahoo.it" )] + ("Stickell" , "l.stickell@yahoo.it" ), + ("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] INFO_PATTERN = r'title="(?P<N>.+?)".+>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>File doesn\'t exist' @@ -39,18 +40,20 @@ class NitroflareCom(SimpleHoster): def handle_free(self, pyfile): #: Used here to load the cookies which will be required later + self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) + self.load(pyfile.url, post={'goToFreePage': ""}) - self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) self.data = self.load("http://nitroflare.com/ajax/freeDownload.php", - post={'method': "startTimer", 'fileId': self.info['pattern']['ID']}) + post={'method': "startTimer", + 'fileId': self.info['pattern']['ID']}) self.check_errors() try: js_file = self.load("http://nitroflare.com/js/downloadFree.js?v=1.0.1") - var_time = re.search("var time = (\\d+);", js_file) - wait_time = int(var_time.groups()[0]) + var_time = re.search(r'var time = (\d+);', js_file).group(1) + wait_time = int(var_time) except Exception: wait_time = 60 @@ -65,4 +68,7 @@ class NitroflareCom(SimpleHoster): 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) + if "The captcha wasn't entered correctly" in self.data: + self.retry_captcha() + return super(NitroflareCom, self).handle_free(pyfile) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 51caaa657..e84a1a34b 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.misc import format_exc class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "1.00" + __version__ = "1.01" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(?:es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?\w+)?' @@ -40,7 +40,7 @@ class OneFichierCom(SimpleHoster): NAME_PATTERN = r'>File\s*Name :</td>\s*<td.*>(?P<N>.+?)<' SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - OFFLINE_PATTERN = r'File not found !\s*<' + OFFLINE_PATTERN = r'(?:File not found !\s*<)|(?:>The requested file has been deleted following an abuse request\.<)' LINK_PATTERN = r'<a href="(.+?)".*>Click here to download the file</a>' WAIT_PATTERN = r'>You must wait \d+ minutes' diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 52aab2411..3b11e1dc8 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -15,7 +15,7 @@ from module.plugins.internal.misc import json, seconds_to_midnight class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' @@ -27,10 +27,11 @@ class RapidgatorNet(SimpleHoster): __description__ = """Rapidgator.net hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("chrox", None), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("zoidberg", "zoidberg@mujmail.cz" ), + ("chrox", None ), + ("stickell", "l.stickell@yahoo.it" ), + ("Walter Purcaro", "vuolter@gmail.com" ), + ("GammaCode", "nitzo2001[AT]yahoo[DOT]com")] API_URL = "http://rapidgator.net/api/file" @@ -86,8 +87,7 @@ class RapidgatorNet(SimpleHoster): return json_data['response'] elif status == 423: - self.account.empty() - self.retry() + self.restart(msg=json_data['response_details'], premium=False) else: self.account.relogin() diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index 84f6ead1e..1971888c9 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -12,7 +12,7 @@ from module.plugins.internal.misc import Periodical, compare_time, decode, isite class Account(Plugin): __name__ = "Account" __type__ = "account" - __version__ = "0.72" + __version__ = "0.74" __status__ = "stable" __description__ = """Base account plugin""" @@ -203,7 +203,7 @@ class Account(Plugin): refresh = False self.reset() - if refresh: + if refresh and self.info['login']['valid']: self.log_info(_("Grabbing account info for user `%s`...") % self.user) self.info = self._grab_info() @@ -367,9 +367,11 @@ class Account(Plugin): % (user, time_data)) if data['trafficleft'] == 0: + self.log_warning(_("Not using account `%s` because the account has no traffic left") % user) continue if time.time() > data['validuntil'] > 0: + self.log_warning(_("Not using account `%s` because the account has expired") % user) continue if data['premium']: |