diff options
author | Nitzo <nitzo2001@yahoo.com> | 2016-07-30 01:24:11 +0200 |
---|---|---|
committer | Nitzo <nitzo2001@yahoo.com> | 2016-07-30 01:24:11 +0200 |
commit | 0e1e9b6eefa84ad1617b61580b821bed44940a5a (patch) | |
tree | 6070b96e94d94116e42c9a2b5c79fab5ada31e9a | |
parent | [Captcha9Kw] Bypass #1996 (2) (diff) | |
download | pyload-0e1e9b6eefa84ad1617b61580b821bed44940a5a.tar.xz |
[New Creapter] MirrorcreatorCom (fix #2200)
-rw-r--r-- | module/plugins/crypter/MirrorcreatorCom.py | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/module/plugins/crypter/MirrorcreatorCom.py b/module/plugins/crypter/MirrorcreatorCom.py new file mode 100644 index 000000000..0e422281f --- /dev/null +++ b/module/plugins/crypter/MirrorcreatorCom.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- + +import os +import re + +from module.plugins.internal.Crypter import Crypter +from module.plugins.internal.misc import replace_patterns + + +class MirrorcreatorCom(Crypter): + __name__ = "MirrorcreatorCom" + __type__ = "crypter" + __version__ = "0.01" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.)?(?:mirrorcreator\.com/(?:files/|download\.php\?uid=)|mir\.cr/)(?P<ID>\w{8})' + __config__ = [("activated" , "bool", "Activated" , True), + ("hosters_priority" , "str" , "Prefered hoster priority (bar-separated)", "" ), + ("ignored_hosters" , "str" , "Ignored hoster list (bar-separated)" , "" ), + ("grab_all" , "bool", "Grab all URLs (default only first match)", False)] + + __description__ = """Mirrorcreator.com decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] + + + URL_REPLACEMENTS = [(__pattern__ + '.*', r'https://www.mirrorcreator.com/download.php?uid=\g<ID>')] + + OFFLINE_PATTERN = r'>Unfortunately, the link you have clicked is not available|>Error - Link disabled or is invalid|>Links Unavailable as the File Belongs to Suspended Account\\. <|>Links Unavailable\\.<' + LINK_PATTERN = r'<div class="highlight redirecturl">(.+?)<' + + + def decrypt(self, pyfile): + pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) + + hosters_priority = [_h for _h in self.config.get('hosters_priority').split('|') if _h] + ignored_hosters = [_h for _h in self.config.get('ignored_hosters').split('|') if _h] + + self.data = self.load(pyfile.url) + + m = re.search(self.OFFLINE_PATTERN, self.data) + if m: + self.offline() + + pack_name, pack_folder = self.get_package_info() + + m = re.search(r'"(/mstat\.php\?uid=%s.+?)"' % self.info['pattern']['ID'], self.data) + if m is None: + self.fail("mstat URL not found") + + self.data = self.load(self.fixurl(m.group(1))) + + hosters_data = {} + for _tr in re.findall(r'<tr>(.+?)</tr>', self.data, re.S): + m = re.search(r'<a href="(/showlink\.php\?uid=%s.+?)".*&hname=(\w+)' % self.info['pattern']['ID'], _tr, re.S) + if m: + hosters_data[m.group(2)] = m.group(1) + + + choosen_hosters = [] + # priority hosters goes first + for _h in hosters_priority: + if _h in hosters_data and _h not in ignored_hosters: + self.log_debug(_("Adding '%s' link") % _h) + choosen_hosters.append(_h) + if not self.config.get('grab_all'): + break + + # Now the rest of the hosters + if self.config.get('grab_all') or (not self.config.get('grab_all') and not choosen_hosters): + for _h in hosters_data: + if _h not in ignored_hosters and _h not in choosen_hosters: + self.log_debug(_("Adding '%s' link") % _h) + choosen_hosters.append(_h) + if not self.config.get('grab_all'): + break + + pack_links = [self.resolve_hoster(hosters_data[_h]) for _h in choosen_hosters] + + if pack_links: + self.packages.append((pack_name, pack_links, pack_folder)) + + + def resolve_hoster(self, link): + self.data = self.load(self.fixurl(link)) + + m = re.search(self.LINK_PATTERN, self.data) + if m is None: + self.fail("Link pattern not found") + + return m.group(1) + + + def get_package_info(self): + m = re.search(r'<title>Download links for ([^<]+) - Mirrorcreator', self.data) + if m: + pack_name = m.group(1) + + # We remove file extension from package name + while True: + pack_name, ext = os.path.splitext(pack_name) + if ext == "": + break + + return pack_name, pack_name + + else: # Fallback to defaults + return self.package.name, self.package.folder + + + |