MCPcopy Create free account
hub / github.com/pyload/pyload / handle_free

Method handle_free

module/plugins/hoster/UpstoreNet.py:40–86  ·  view source on GitHub ↗
(self, pyfile)

Source from the content-addressed store, hash-verified

38 COOKIES = [("upstore.net", "lang", "en")]
39
40 def handle_free(self, pyfile):
41 #: STAGE 1: get link to continue
42 post_data = {'hash': self.info['pattern']['ID'],
43 'free': 'Slow download'}
44 self.data = self.load(pyfile.url, post=post_data)
45
46 #: STAGE 2: solve captcha and wait
47 #: First get the infos we need: self.captcha key and wait time
48 m = re.search(self.WAIT_PATTERN, self.data)
49 if m is None:
50 self.error(_("Wait pattern not found"))
51
52 #: prepare the waiting
53 wait_time = int(m.group(1))
54 self.set_wait(wait_time)
55
56 #: then, handle the captcha
57 recaptcha = ReCaptcha(self.pyfile)
58
59 captcha_key = recaptcha.detect_key()
60 if captcha_key is None:
61 self.fail(_("captcha key not found"))
62
63 self.captcha = recaptcha
64
65 post_data = {'hash': self.info['pattern']['ID'],
66 'free': 'Get download link'}
67 post_data['g-recaptcha-response'], _ = recaptcha.challenge(captcha_key)
68
69 #: then, do the waiting
70 self.wait()
71
72 self.data = self.load(pyfile.url, post=post_data)
73
74 # check whether the captcha was wrong
75 if "Captcha check failed" in self.data:
76 self.captcha.invalid()
77
78 else:
79 self.captcha.correct()
80
81 # STAGE 3: get direct link or wait time
82 self.check_errors()
83
84 m = re.search(self.LINK_FREE_PATTERN, self.data)
85 if m is not None:
86 self.link = m.group(1)

Callers

nothing calls this directly

Calls 13

detect_keyMethod · 0.95
challengeMethod · 0.95
ReCaptchaClass · 0.90
set_waitMethod · 0.80
_Function · 0.50
loadMethod · 0.45
searchMethod · 0.45
errorMethod · 0.45
failMethod · 0.45
waitMethod · 0.45
invalidMethod · 0.45
correctMethod · 0.45

Tested by

no test coverage detected