Repository navigation
Expand file tree
/
Copy pathDevhostStFolder.py
More file actions
64 lines (47 loc) · 2.31 KB
/
Copy pathDevhostStFolder.py
File metadata and controls
64 lines (47 loc) · 2.31 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://d-h.st/users/shine/?fld_id=37263#files
import re
import urlparse
from module.plugins.internal.SimpleCrypter import SimpleCrypter
class DevhostStFolder(SimpleCrypter):
__name__ = "DevhostStFolder"
__type__ = "crypter"
__version__ = "0.10"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?d-h\.st/users/(?P<USER>\w+)(/\?fld_id=(?P<ID>\d+))?'
__config__ = [("activated" , "bool" , "Activated" , True ),
("use_premium" , "bool" , "Use premium account if available" , True ),
("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"),
("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )]
__description__ = """D-h.st folder decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"),
("Walter Purcaro", "vuolter@gmail.com")]
LINK_PATTERN = r'(?:/> |;">)<a href="(.+?)"(?!>Back to \w+<)'
OFFLINE_PATTERN = r'"/cHP">test\.png<'
def check_name_size(self, getinfo=True):
if not self.info or getinfo:
self.log_debug("File info (BEFORE): %s" % self.info)
self.info.update(self.get_info(self.pyfile.url, self.data))
self.log_debug("File info (AFTER): %s" % self.info)
try:
if self.info['pattern']['ID'] == "0":
raise
p = r'href="(.+?)">Back to \w+<'
m = re.search(p, self.data)
html = self.load(urlparse.urljoin("http://d-h.st/", m.group(1)),
cookies=False)
p = '\?fld_id=%s.*?">(.+?)<' % self.info['pattern']['ID']
m = re.search(p, html)
self.pyfile.name = m.group(1)
except Exception, e:
self.log_debug(e, trace=True)
self.pyfile.name = self.info['pattern']['USER']
try:
folder = self.info['folder'] = self.pyfile.name
except Exception:
pass
self.log_debug("File name: %s" % self.pyfile.name,
"File folder: %s" % self.pyfile.name)