Repository navigation
Expand file tree
/
Copy pathLoadTo.py
More file actions
69 lines (51 loc) · 2.38 KB
/
Copy pathLoadTo.py
File metadata and controls
69 lines (51 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- coding: utf-8 -*-
#
# Test links:
# http://www.load.to/JWydcofUY6/random.bin
# http://www.load.to/oeSmrfkXE/random100.bin
import re
from module.plugins.captcha.SolveMedia import SolveMedia
from module.plugins.internal.SimpleHoster import SimpleHoster
class LoadTo(SimpleHoster):
__name__ = "LoadTo"
__type__ = "hoster"
__version__ = "0.28"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?load\.to/\w+'
__config__ = [("activated" , "bool", "Activated" , True),
("use_premium" , "bool", "Use premium account if available" , True),
("fallback" , "bool", "Fallback to free download if premium fails" , True),
("chk_filesize", "bool", "Check file size" , True),
("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )]
__description__ = """Load.to hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("halfman", "Pulpan3@gmail.com"),
("stickell", "l.stickell@yahoo.it")]
NAME_PATTERN = r'<h1>(?P<N>.+?)</h1>'
SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)'
OFFLINE_PATTERN = r'>Can\'t find file'
LINK_FREE_PATTERN = r'<form method="post" action="(.+?)"'
WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"'
URL_REPLACEMENTS = [(r'(\w)$', r'\1/')]
def setup(self):
self.multiDL = True
self.chunk_limit = 1
def handle_free(self, pyfile):
#: Search for Download URL
m = re.search(self.LINK_FREE_PATTERN, self.data)
if m is None:
self.error(_("LINK_FREE_PATTERN not found"))
self.link = m.group(1)
#: Set Timer - may be obsolete
m = re.search(self.WAIT_PATTERN, self.data)
if m is not None:
self.wait(m.group(1))
#: Load.to is using SolveMedia captchas since ~july 2014:
self.captcha = SolveMedia(pyfile)
captcha_key = self.captcha.detect_key()
if captcha_key:
response, challenge = self.captcha.challenge(captcha_key)
self.download(self.link,
post={'adcopy_challenge': challenge,
'adcopy_response' : response,
'returnUrl' : pyfile.url})