Repository navigation
Expand file tree
/
Copy pathXFileSharingPro.py
More file actions
110 lines (79 loc) · 4.8 KB
/
Copy pathXFileSharingPro.py
File metadata and controls
110 lines (79 loc) · 4.8 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# -*- coding: utf-8 -*-
import re
from pyload.plugin.Hook import Hook
class XFileSharingPro(Hook):
__name = "XFileSharingPro"
__type = "hook"
__version = "0.37"
__config = [("activated" , "bool", "Activated" , True ),
("use_hoster_list" , "bool", "Load listed hosters only" , False),
("use_crypter_list", "bool", "Load listed crypters only" , False),
("use_builtin_list", "bool", "Load built-in plugin list" , True ),
("hoster_list" , "str" , "Hoster list (comma separated)" , "" ),
("crypter_list" , "str" , "Crypter list (comma separated)", "" )]
__description = """Load XFileSharingPro based hosters and crypter which don't need a own plugin to run"""
__license = "GPLv3"
__authors = [("Walter Purcaro", "vuolter@gmail.com")]
# event_list = ["pluginConfigChanged"]
regexp = {'hoster' : (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)',
r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'),
'crypter': (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+',
r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')}
HOSTER_BUILTIN = [#WORKING HOSTERS:
"backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in",
"filevice.com", "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com", "ryushare.com",
"salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com",
# NOT TESTED:
"101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com",
"rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com",
"vidbull.com", "worldbytez.com", "zalaa.com", "zomgupload.com",
# NOT WORKING:
"amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"]
CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"]
# def pluginConfigChanged(self, plugin, name, value):
# self.loadPattern()
def activate(self):
self.loadPattern()
def loadPattern(self):
use_builtin_list = self.getConfig("use_builtin_list")
for type in ("hoster", "crypter"):
every_plugin = not self.getConfig('use_%s_list' % type)
if every_plugin:
self.logInfo(_("Handling any %s I can!") % type)
pattern = self.regexp[type][0]
else:
plugins = self.getConfig('%s_list' % type)
plugin_set = set(plugins.replace(' ', '').replace('\\', '').replace('|', ',').replace(';', ',').lower().split(','))
if use_builtin_list:
plugin_set |= set(x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper()))
plugin_set -= set(('', u''))
if not plugin_set:
self.logInfo(_("No %s to handle") % type)
self._unload(type)
return
match_list = '|'.join(sorted(plugin_set))
len_match_list = len(plugin_set)
self.logInfo(_("Handling %d %s%s: %s") % (len_match_list,
type,
"" if len_match_list == 1 else "s",
match_list.replace('|', ', ')))
pattern = self.regexp[type][1] % match_list.replace('.', '\.')
dict = self.core.pluginManager.plugins[type]['XFileSharingPro']
dict['pattern'] = pattern
dict['re'] = re.compile(pattern)
self.logDebug("Loaded %s pattern: %s" % (type, pattern))
def _unload(self, type):
dict = self.core.pluginManager.plugins[type]['XFileSharingPro']
dict['pattern'] = r'^unmatchable$'
dict['re'] = re.compile(dict['pattern'])
def deactivate(self):
# self.unloadHoster("BasePlugin")
for type in ("hoster", "crypter"):
self._unload(type, "XFileSharingPro")
# def downloadFailed(self, pyfile):
# if pyfile.pluginname == "BasePlugin" \
# and pyfile.hasStatus("failed") \
# and not self.getConfig('use_hoster_list') \
# and self.unloadHoster("BasePlugin"):
# self.logDebug("Unloaded XFileSharingPro from BasePlugin")
# pyfile.setStatus("queued")