Repository navigation
Expand file tree
/
Copy pathLoadTo.py
More file actions
64 lines (46 loc) · 1.89 KB
/
Copy pathLoadTo.py
File metadata and controls
64 lines (46 loc) · 1.89 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
# -*- coding: utf-8 -*-
#
# Test links:
# http://www.load.to/JWydcofUY6/random.bin
# http://www.load.to/oeSmrfkXE/random100.bin
import re
from pyload.plugin.captcha.SolveMedia import SolveMedia
from pyload.plugin.internal.SimpleHoster import SimpleHoster
class LoadTo(SimpleHoster):
__name = "LoadTo"
__type = "hoster"
__version = "0.22"
__pattern = r'http://(?:www\.)?load\.to/\w+'
__config = [("use_premium", "bool", "Use premium account if available", True)]
__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.chunkLimit = 1
def handle_free(self, pyfile):
# Search for Download URL
m = re.search(self.LINK_FREE_PATTERN, self.html)
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.html)
if m:
self.wait(m.group(1))
# Load.to is using solvemedia captchas since ~july 2014:
solvemedia = SolveMedia(self)
captcha_key = solvemedia.detect_key()
if captcha_key:
response, challenge = solvemedia.challenge(captcha_key)
self.download(self.link,
post={'adcopy_challenge': challenge,
'adcopy_response' : response,
'returnUrl' : pyfile.url})