diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/MegaRapidoNet.py | 64 | ||||
-rw-r--r-- | module/plugins/hooks/MegaRapidoNet.py | 178 | ||||
-rw-r--r-- | module/plugins/hoster/MegaRapidoNet.py | 98 |
3 files changed, 143 insertions, 197 deletions
diff --git a/module/plugins/accounts/MegaRapidoNet.py b/module/plugins/accounts/MegaRapidoNet.py index 55b52907c..80e066244 100644 --- a/module/plugins/accounts/MegaRapidoNet.py +++ b/module/plugins/accounts/MegaRapidoNet.py @@ -1,47 +1,57 @@ # -*- coding: utf-8 -*- + import re -from time import mktime, strptime, time +import time from module.plugins.Account import Account class MegaRapidoNet(Account): - __name__ = "MegaRapidoNet" - __version__ = "0.01" - __type__ = "account" - __description__ = """Megarapido.net account plugin""" - __author_name__ = ("Kagenoshin") - __author_mail__ = ("kagenoshin@gmx.ch") + __name__ = "MegaRapidoNet" + __type__ = "account" + __version__ = "0.02" + + __description__ = """MegaRapido.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + + + VALID_UNTIL_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?[\'"]premium_index[\'"][^>]*>[^<]*?<[^>]*?b[^>]*>\s*?TEMPO\s*?PREMIUM[^<]*<[^>]*?/b[^>]*>\s*?(\d*)[^\d]*?DIAS[^\d]*?(\d*)[^\d]*?HORAS[^\d]*?(\d*)[^\d]*?MINUTOS[^\d]*?(\d*)[^\d]*?SEGUNDOS' + USER_ID_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']checkbox_compartilhar["\'][^>]*>[^<]*<\s*?input[^>]*?name\s*?=\s*?["\']usar["\'][^>]*>[^<]*<\s*?input[^>]*?name\s*?=\s*?["\']user["\'][^>]*?value\s*?=\s*?["\'](.*?)\s*?["\']' - VALIDUNTIL_PATTERN = re.compile(r'<\s*?div[^>]*?class\s*?=\s*?[\'"]premium_index[\'"][^>]*>[^<]*?<[^>]*?b[^>]*>\s*?TEMPO\s*?PREMIUM[^<]*<[^>]*?/b[^>]*>\s*?(\d*)[^\d]*?DIAS[^\d]*?(\d*)[^\d]*?HORAS[^\d]*?(\d*)[^\d]*?MINUTOS[^\d]*?(\d*)[^\d]*?SEGUNDOS', re.I) - USER_ID_PATTERN= re.compile(r' <\s*?div[^>]*?class\s*?=\s*?["\']checkbox_compartilhar["\'][^>]*>[^<]*<\s*?input[^>]*?name\s*?=\s*?["\']usar["\'][^>]*>[^<]*<\s*?input[^>]*?name\s*?=\s*?["\']user["\'][^>]*?value\s*?=\s*?["\'](.*?)\s*?["\']', re.I) def loadAccountInfo(self, user, req): - response = req.load("http://megarapido.net/gerador", decode=True) + validuntil = None + trafficleft = None + premium = False + + html = req.load("http://megarapido.net/gerador", decode=True) - validuntil = self.VALIDUNTIL_PATTERN.search(response) + validuntil = re.search(self.VALID_UNTIL_PATTERN, html) if validuntil: #hier weitermachen!!! (müssen umbedingt die zeit richtig machen damit! (sollte aber möglich)) - validuntil = time() + int(validuntil.group(1))*24*3600 + int(validuntil.group(2))*3600 + int(validuntil.group(3))*60 + int(validuntil.group(4)) + validuntil = time.time() + int(validuntil.group(1)) * 24 * 3600 + int(validuntil.group(2)) * 3600 + int(validuntil.group(3)) * 60 + int(validuntil.group(4)) + trafficleft = -1 + premium = True + + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} - if validuntil: - return {"trafficleft": -1, "validuntil": validuntil} - else: - return {"premium": False} def login(self, user, data, req): - self.loginname = user - self.password = data["password"] - post_data = {'login': self.loginname, 'senha': self.password} req.load("http://megarapido.net/login") - response = req.load("http://megarapido.net/painel_user/ajax/logar.php", post=post_data, decode=True) - response = req.load("http://megarapido.net/gerador") - if 'sair' not in response.lower(): + req.load("http://megarapido.net/painel_user/ajax/logar.php", + post={'login': user, 'senha': data['password']}, + decode=True) + + html = req.load("http://megarapido.net/gerador") + + if "sair" not in html.lower(): self.wrongPassword() else: - user_id = self.USER_ID_PATTERN.search(response) - if user_id: - user_id = user_id.group(1) - self.setStorage("MegarapidoNet_userID", user_id) + m = re.search(self.USER_ID_PATTERN, html) + if m: + data['uid'] = m.group(1) else: - self.fail("Couldn't find the user ID")
\ No newline at end of file + self.fail("Couldn't find the user ID") diff --git a/module/plugins/hooks/MegaRapidoNet.py b/module/plugins/hooks/MegaRapidoNet.py index e59b94adf..33c74ae6f 100644 --- a/module/plugins/hooks/MegaRapidoNet.py +++ b/module/plugins/hooks/MegaRapidoNet.py @@ -1,117 +1,81 @@ # -*- coding: utf-8 -*- -import re - -from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster - - -class MegaRapidoNet(MultiHoster): - __name__ = "MegaRapidoNet" - __version__ = "0.01" - __type__ = "hook" - __config__ = [("activated", "bool", "Activated", "False"), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", "")] - __description__ = """Megarapido.net hook plugin""" - __author_name__ = ("Kagenoshin") - __author_mail__ = ("kagenoshin@gmx.ch") - HOSTER_PATTERN = re.compile(r'align\s*?=\s*?["\']*?left.*?<\s*?strong\s*?>([^<]*?)<', re.I) - - def getHoster(self): - hosters = { - '1fichier': [],#leave it there are so many possible addresses? - '1st-files': ['1st-files.com'], - '2shared': ['2shared.com'], - '4shared': ['4shared.com', '4shared-china.com'], - 'asfile': ['http://asfile.com/'], - 'bitshare': ['bitshare.com'], - 'brupload': ['brupload.net'], - 'crocko': ['crocko.com','easy-share.com'], - 'dailymotion': ['dailymotion.com'], - 'depfile': ['depfile.com'], - 'depositfiles': ['depositfiles.com', 'dfiles.eu'], - 'dizzcloud': ['dizzcloud.com'], - 'dl.dropbox': [], - 'extabit': ['extabit.com'], - 'extmatrix': ['extmatrix.com'], - 'facebook': [], - 'file4go': ['file4go.com'], - 'filecloud': ['filecloud.io','ifile.it','mihd.net'], - 'filefactory': ['filefactory.com'], - 'fileom': ['fileom.com'], - 'fileparadox': ['fileparadox.in'], - 'filepost': ['filepost.com', 'fp.io'], - 'filerio': ['filerio.in','filerio.com','filekeen.com'], - 'filesflash': ['filesflash.com'], - 'firedrive': ['firedrive.com', 'putlocker.com'], - 'flashx': [], - 'freakshare': ['freakshare.net', 'freakshare.com'], - 'gigasize': ['gigasize.com'], - 'hipfile': ['hipfile.com'], - 'junocloud': ['junocloud.me'], - 'letitbit': ['letitbit.net','shareflare.net'], - 'mediafire': ['mediafire.com'], - 'mega': ['mega.co.nz'], - 'megashares': ['megashares.com'], - 'metacafe': ['metacafe.com'], - 'netload': ['netload.in'], - 'oboom': ['oboom.com'], - 'rapidgator': ['rapidgator.net'], - 'rapidshare': ['rapidshare.com'], - 'rarefile': ['rarefile.net'], - 'ryushare': ['ryushare.com'], - 'sendspace': ['sendspace.com'], - 'turbobit': ['turbobit.net', 'unextfiles.com'], - 'uploadable': ['uploadable.ch'], - 'uploadbaz': ['uploadbaz.com'], - 'uploaded': ['uploaded.to', 'uploaded.net', 'ul.to'], - 'uploadhero': ['uploadhero.com'], - 'uploading': ['uploading.com'], - 'uptobox': ['uptobox.com'], - 'xvideos': ['xvideos.com'], - 'youtube': ['youtube.com'] - } +import re - #check if the list is still valid - #has to be added! self.check_for_new_or_removed_hosters(hosters) +from module.plugins.internal.MultiHook import MultiHook + + +class MegaRapidoNet(MultiHook): + __name__ = "MegaRapidoNet" + __type__ = "hook" + __version__ = "0.02" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """MegaRapido.net hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + + + def getHosters(self): + hosters = {'1fichier': [],#leave it there are so many possible addresses? + '1st-files': ['1st-files.com'], + '2shared': ['2shared.com'], + '4shared': ['4shared.com', '4shared-china.com'], + 'asfile': ['http://asfile.com/'], + 'bitshare': ['bitshare.com'], + 'brupload': ['brupload.net'], + 'crocko': ['crocko.com','easy-share.com'], + 'dailymotion': ['dailymotion.com'], + 'depfile': ['depfile.com'], + 'depositfiles': ['depositfiles.com', 'dfiles.eu'], + 'dizzcloud': ['dizzcloud.com'], + 'dl.dropbox': [], + 'extabit': ['extabit.com'], + 'extmatrix': ['extmatrix.com'], + 'facebook': [], + 'file4go': ['file4go.com'], + 'filecloud': ['filecloud.io','ifile.it','mihd.net'], + 'filefactory': ['filefactory.com'], + 'fileom': ['fileom.com'], + 'fileparadox': ['fileparadox.in'], + 'filepost': ['filepost.com', 'fp.io'], + 'filerio': ['filerio.in','filerio.com','filekeen.com'], + 'filesflash': ['filesflash.com'], + 'firedrive': ['firedrive.com', 'putlocker.com'], + 'flashx': [], + 'freakshare': ['freakshare.net', 'freakshare.com'], + 'gigasize': ['gigasize.com'], + 'hipfile': ['hipfile.com'], + 'junocloud': ['junocloud.me'], + 'letitbit': ['letitbit.net','shareflare.net'], + 'mediafire': ['mediafire.com'], + 'mega': ['mega.co.nz'], + 'megashares': ['megashares.com'], + 'metacafe': ['metacafe.com'], + 'netload': ['netload.in'], + 'oboom': ['oboom.com'], + 'rapidgator': ['rapidgator.net'], + 'rapidshare': ['rapidshare.com'], + 'rarefile': ['rarefile.net'], + 'ryushare': ['ryushare.com'], + 'sendspace': ['sendspace.com'], + 'turbobit': ['turbobit.net', 'unextfiles.com'], + 'uploadable': ['uploadable.ch'], + 'uploadbaz': ['uploadbaz.com'], + 'uploaded': ['uploaded.to', 'uploaded.net', 'ul.to'], + 'uploadhero': ['uploadhero.com'], + 'uploading': ['uploading.com'], + 'uptobox': ['uptobox.com'], + 'xvideos': ['xvideos.com'], + 'youtube': ['youtube.com']} - #build list hoster_list = [] for item in hosters.itervalues(): hoster_list.extend(item) return hoster_list - - def check_for_new_or_removed_hosters(self, hosters): - #get the old hosters - old_hosters = hosters.keys() - - #load the current hosters from vipleech4u.com - page = getURL('http://vipleech4u.com/hosts.php') - current_hosters = self.HOSTER_PATTERN.findall(page) - current_hosters = [x.lower() for x in current_hosters] - - #let's look for new hosters - new_hosters = [] - - for hoster in current_hosters: - if not hoster in old_hosters: - new_hosters.append(hoster) - - #let's look for removed hosters - removed_hosters = [] - - for hoster in old_hosters: - if not hoster in current_hosters: - removed_hosters.append(hoster) - - if new_hosters: - self.logDebug('The following new hosters were found on vipleech4u.com: %s' % str(new_hosters)) - - if removed_hosters: - self.logDebug('The following hosters were removed from vipleech4u.com: %s' % str(removed_hosters)) - - if not (new_hosters and removed_hosters): - self.logDebug('The hoster list is still valid.') diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py index 2978c72e1..1b0e4ffb6 100644 --- a/module/plugins/hoster/MegaRapidoNet.py +++ b/module/plugins/hoster/MegaRapidoNet.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -import re - -from module.plugins.Hoster import Hoster from random import randint +from module.plugins.internal.MultiHoster import MultiHoster + + def random_with_N_digits(n): rand = "0." not_zero = 0 @@ -19,63 +19,35 @@ def random_with_N_digits(n): else: return random_with_N_digits(n) -class MegaRapidoNet(Hoster): - __name__ = "MegaRapidoNet" - __version__ = "0.01" - __type__ = "hoster" - __pattern__ = r"http://(?:www\.)*?(?:[^\.]+)\.megarapido\.net/\?file=" - __description__ = """Megarapido.net hoster plugin""" - __author_name__ = ("Kagenoshin") - __author_mail__ = ("kagenoshin@gmx.ch") - - DOWNLOAD_LINK_PATTERN = re.compile(r'<\s*?a[^>]*?title\s*?=\s*?["\'][^"\']*?download["\'][^>]*?href=["\']([^"\']*)', re.I) - ERROR_MESSAGE_PATTERN = re.compile(r'<\s*?div[^>]*?class\s*?=\s*?["\']?alert-message error[^>]*>([^<]*)',re.I) - - def setup(self): - self.resumeDownload = self.multiDL = True - self.chunkLimit = 1 - - def process(self, pyfile): - if not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "vipleech4u.com") - self.fail("No vipleech4u.com account provided") - - self.logDebug("Old URL: %s" % pyfile.url) - - new_url = pyfile.url - - #load userID - user_id = self.getStorage("MegarapidoNet_userID") - - #upload the link which has to be loaded - if not re.match(self.__pattern__, new_url): - page = self.load("http://megarapido.net/gerar.php", post={"rand":random_with_N_digits(16), "urllist":new_url, "links":new_url, "exibir":"normal", "usar":"premium", "user":user_id, "autoreset":""}) - if "desloga e loga novamente para gerar seus links" in page.lower(): - self.fail("Restart pyload, because you have logged in at another place.") - - error_1 = self.ERROR_MESSAGE_PATTERN.search(page) - if error_1: - self.fail("%s" %error_1.group(1)) - - download_link = self.DOWNLOAD_LINK_PATTERN.search(page) - if download_link: - download_link = download_link.group(1) - else: - self.fail("Couldn't find a download link.") - else: - download_link = new_url - - #tests (todo) - if re.search(r'You have generated maximum links available to you today', page, re.I): - self.fail('Daily limit reached.') - - self.setWait(5) - self.wait() - self.logDebug("Unrestricted URL: " + download_link) - - self.download(download_link, disposition=True) - - check = self.checkDownload({"bad": "<html"}) - - if check == "bad": - self.retry(24, 150, 'Bad file downloaded') + +class MegaRapidoNet(MultiHoster): + __name__ = "MegaRapidoNet" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'http://(?:www\.)?\w+\.megarapido\.net/\?file=\w+' + + __description__ = """MegaRapido.net multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + + + LINK_PREMIUM_PATTERN = r'<\s*?a[^>]*?title\s*?=\s*?["\'][^"\']*?download["\'][^>]*?href=["\']([^"\']*)' + + ERROR_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']?alert-message error[^>]*>([^<]*)' + + + def handlePremium(self, pyfile): + self.html = self.load("http://megarapido.net/gerar.php", + post={'rand' :random_with_N_digits(16), + 'urllist' : pyfile.url, + 'links' : pyfile.url, + 'exibir' : "normal", + 'usar' : "premium", + 'user' : self.account.getAccountInfo(self.user).get('sid', None), + 'autoreset': ""}) + + if "desloga e loga novamente para gerar seus links" in self.html.lower(): + self.error("You have logged in at another place") + + return super(MegaRapidoNet, self).handlePremium(pyfile) |