MCPcopy Index your code
hub / github.com/pyload/pyload / decrypt

Method decrypt

module/plugins/crypter/MirrorcreatorCom.py:35–92  ·  view source on GitHub ↗
(self, pyfile)

Source from the content-addressed store, hash-verified

33 LINK_PATTERN = r'<div class="highlight redirecturl">(.+?)<'
34
35 def decrypt(self, pyfile):
36 pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS)
37
38 hosters_priority = [_h for _h in self.config.get(
39 'hosters_priority').split('|') if _h]
40 ignored_hosters = [_h for _h in self.config.get(
41 'ignored_hosters').split('|') if _h]
42
43 self.data = self.load(pyfile.url)
44
45 m = re.search(self.OFFLINE_PATTERN, self.data)
46 if m is not None:
47 self.offline()
48
49 pack_name, pack_folder = self.get_package_info()
50
51 m = re.search(
52 r'"(/mstat\.php\?uid=%s.+?)"' %
53 self.info['pattern']['ID'],
54 self.data)
55 if m is None:
56 self.fail("mstat URL not found")
57
58 self.data = self.load(self.fixurl(m.group(1)))
59
60 hosters_data = {}
61 for _tr in re.findall(r'<tr>(.+?)</tr>', self.data, re.S):
62 m = re.search(
63 r'<a href="(/showlink\.php\?uid=%s.+?)".*&hname=(\w+)' %
64 self.info['pattern']['ID'], _tr, re.S)
65 if m is not None:
66 hosters_data[m.group(2)] = m.group(1)
67
68 choosen_hosters = []
69 # priority hosters goes first
70 for _h in hosters_priority:
71 if _h in hosters_data and _h not in ignored_hosters:
72 self.log_debug("Adding '%s' link" % _h)
73 choosen_hosters.append(_h)
74 if not self.config.get('grab_all'):
75 break
76
77 # Now the rest of the hosters
78 if self.config.get('grab_all') or (
79 not self.config.get('grab_all') and not choosen_hosters):
80 for _h in hosters_data:
81 if _h not in ignored_hosters and _h not in choosen_hosters:
82 self.log_debug("Adding '%s' link" % _h)
83 choosen_hosters.append(_h)
84 if not self.config.get('grab_all'):
85 break
86
87 pack_links = [
88 self.resolve_hoster(
89 hosters_data[_h]) for _h in choosen_hosters]
90
91 if pack_links:
92 self.packages.append((pack_name, pack_links, pack_folder))

Callers

nothing calls this directly

Calls 12

get_package_infoMethod · 0.95
resolve_hosterMethod · 0.95
replace_patternsFunction · 0.85
splitMethod · 0.80
fixurlMethod · 0.80
log_debugMethod · 0.80
getMethod · 0.45
loadMethod · 0.45
searchMethod · 0.45
offlineMethod · 0.45
failMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected