diff options
43 files changed, 100 insertions, 91 deletions
diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index a319096db..8cb0436fc 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -25,7 +25,7 @@ class FreakshareCom(Account): html = self.load("http://freakshare.com/") try: - m = re.search(r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>', html, re.M) + m = re.search(r'ltig bis:</td>\s*<td><b>([\d.:\-]+)</b></td>', html, re.M) validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y - %H:%M")) except Exception: diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 5423b212f..b0cd87938 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -59,7 +59,7 @@ class HellshareCz(Account): self.log_debug("Switch lang - URL: %s" % self.req.lastEffectiveURL) json = self.load("%s?do=locRouter-show" % self.req.lastEffectiveURL) - hash = re.search(r"(--[0-9a-f]+-)", json).group(1) + hash = re.search(r"(--[0-9a-f]+\-)", json).group(1) self.log_debug("Switch lang - HASH: %s" % hash) diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index 0249f2b93..42838690e 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -19,7 +19,7 @@ class OneFichierCom(Account): ("Walter Purcaro", "vuolter@gmail.com")] - VALID_UNTIL_PATTERN = r'Your subscription will end the (\d+-\d+-\d+)' + VALID_UNTIL_PATTERN = r'Your subscription will end the (\d+\-\d+\-\d+)' def grab_info(self, user, password, data): diff --git a/module/plugins/captcha/AdYouLike.py b/module/plugins/captcha/AdYouLike.py index cac73774a..b10d2c399 100644 --- a/module/plugins/captcha/AdYouLike.py +++ b/module/plugins/captcha/AdYouLike.py @@ -31,7 +31,7 @@ class AdYouLike(CaptchaService): self.log_debug("Ayl: %s | Callback: %s" % self.key) return self.key #: Key is the tuple(ayl, callback) else: - self.log_warning(_("Ayl or callback pattern not found")) + self.log_debug("Ayl or callback pattern not found") return None diff --git a/module/plugins/captcha/AdsCaptcha.py b/module/plugins/captcha/AdsCaptcha.py index 613283e53..7dc51565f 100644 --- a/module/plugins/captcha/AdsCaptcha.py +++ b/module/plugins/captcha/AdsCaptcha.py @@ -18,7 +18,7 @@ class AdsCaptcha(CaptchaService): CAPTCHAID_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?.*?CaptchaId=(\d+)' - PUBLICKEY_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?.*?PublicKey=([\w-]+)' + PUBLICKEY_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?.*?PublicKey=([\w\-]+)' def detect_key(self, data=None): @@ -31,7 +31,7 @@ class AdsCaptcha(CaptchaService): self.log_debug("Key: %s | ID: %s" % self.key) return self.key else: - self.log_warning(_("Key or id pattern not found")) + self.log_debug("Key or id pattern not found") return None diff --git a/module/plugins/captcha/ReCaptcha.py b/module/plugins/captcha/ReCaptcha.py index a3ac52cb1..379956be6 100644 --- a/module/plugins/captcha/ReCaptcha.py +++ b/module/plugins/captcha/ReCaptcha.py @@ -23,8 +23,8 @@ class ReCaptcha(CaptchaService): ("zapp-brannigan", "fuerst.reinje@web.de")] - KEY_V1_PATTERN = r'(?:recaptcha(?:/api|\.net)/(?:challenge|noscript)\?k=|Recaptcha\.create\s*\(\s*["\'])([\w-]+)' - KEY_V2_PATTERN = r'(?:data-sitekey=["\']|["\']sitekey["\']:\s*["\'])([\w-]+)' + KEY_V1_PATTERN = r'(?:recaptcha(?:/api|\.net)/(?:challenge|noscript)\?k=|Recaptcha\.create\s*\(\s*["\'])([\w\-]+)' + KEY_V2_PATTERN = r'(?:data-sitekey=["\']|["\']sitekey["\']:\s*["\'])([\w\-]+)' def detect_key(self, data=None): diff --git a/module/plugins/captcha/SolveMedia.py b/module/plugins/captcha/SolveMedia.py index a5a49b68e..302d229b8 100644 --- a/module/plugins/captcha/SolveMedia.py +++ b/module/plugins/captcha/SolveMedia.py @@ -29,7 +29,7 @@ class SolveMedia(CaptchaService): self.log_debug("Key: %s" % self.key) return self.key else: - self.log_warning(_("Key pattern not found")) + self.log_debug("Key pattern not found") return None diff --git a/module/plugins/crypter/Dereferer.py b/module/plugins/crypter/Dereferer.py index 0a1c1a918..8ecc635ec 100644 --- a/module/plugins/crypter/Dereferer.py +++ b/module/plugins/crypter/Dereferer.py @@ -11,7 +11,7 @@ class Dereferer(SimpleCrypter): __version__ = "0.19" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w-]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/.*?(?P<LINK>(?:ht|f)tps?://.+)' + __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/.*?(?P<LINK>(?:ht|f)tps?://.+)' __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 70f9bc088..51fdcd30b 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -31,7 +31,7 @@ class FilecryptCc(Crypter): # URL_REPLACEMENTS = [(r'.html$', ""), (r'$', ".html")] #@TODO: Extend SimpleCrypter DLC_LINK_PATTERN = r'onclick="DownloadDLC\(\'(.+)\'\);">' - WEBLINK_PATTERN = r"openLink.?'([\w-]*)'," + WEBLINK_PATTERN = r"openLink.?'([\w\-]*)'," CAPTCHA_PATTERN = r'class="safety">Sicherheitsabfrage<' INTERNAL_CAPTCHA_PATTERN = r'<img id="nc" src="(.+?)"' diff --git a/module/plugins/crypter/ILoadTo.py b/module/plugins/crypter/ILoadTo.py index 03826cc5a..7d73b898f 100644 --- a/module/plugins/crypter/ILoadTo.py +++ b/module/plugins/crypter/ILoadTo.py @@ -9,7 +9,7 @@ class ILoadTo(DeadCrypter): __version__ = "0.12" __status__ = "testing" - __pattern__ = r'http://(?:www\.)?iload\.to/go/\d+-[\w.-]+/' + __pattern__ = r'http://(?:www\.)?iload\.to/go/\d+\-[\w\-.]+/' __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Iload.to decrypter plugin""" diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index 29e1cce4f..c5fac837a 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -24,7 +24,7 @@ class SafelinkingNet(Crypter): __authors__ = [("quareevo", "quareevo@arcor.de")] - SOLVEMEDIA_PATTERN = "solvemediaApiKey = '([\w.-]+)';" + SOLVEMEDIA_PATTERN = "solvemediaApiKey = '([\w\-.]+)';" def decrypt(self, pyfile): diff --git a/module/plugins/crypter/SecuredIn.py b/module/plugins/crypter/SecuredIn.py index 95416585a..4731e41f4 100644 --- a/module/plugins/crypter/SecuredIn.py +++ b/module/plugins/crypter/SecuredIn.py @@ -9,7 +9,7 @@ class SecuredIn(DeadCrypter): __version__ = "0.22" __status__ = "testing" - __pattern__ = r'http://(?:www\.)?secured\.in/download-[\d]+-\w{8}\.html' + __pattern__ = r'http://(?:www\.)?secured\.in/download-[\d]+\-\w{8}\.html' __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Secured.in decrypter plugin""" diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index e372d7c6a..c189229ce 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -124,7 +124,7 @@ class ShareLinksBiz(Crypter): #: Request user for captcha coords m = re.search(r'<img src="/captcha.gif\?d=(.+?)&PHPSESSID=(.+?)&legend=1"', self.html) - if not m: + if m is None: self.log_debug("Captcha url data not found, maybe plugin out of date?") self.fail(_("Captcha url data not found")) diff --git a/module/plugins/crypter/TinyurlCom.py b/module/plugins/crypter/TinyurlCom.py index bff1efa12..2b9a8041f 100644 --- a/module/plugins/crypter/TinyurlCom.py +++ b/module/plugins/crypter/TinyurlCom.py @@ -9,7 +9,7 @@ class TinyurlCom(SimpleCrypter): __version__ = "0.03" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?(preview\.)?tinyurl\.com/[\w-]+' + __pattern__ = r'https?://(?:www\.)?(preview\.)?tinyurl\.com/[\w\-]+' __description__ = """Tinyurl.com decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py index ca5c3ba96..615e9f224 100644 --- a/module/plugins/crypter/XFileSharingProFolder.py +++ b/module/plugins/crypter/XFileSharingProFolder.py @@ -11,7 +11,7 @@ class XFileSharingProFolder(XFSCrypter): __version__ = "0.14" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+' + __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+' __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py index ea09c63f9..302f18ac0 100644 --- a/module/plugins/crypter/YoutubeComFolder.py +++ b/module/plugins/crypter/YoutubeComFolder.py @@ -14,7 +14,7 @@ class YoutubeComFolder(Crypter): __version__ = "1.03" __status__ = "testing" - __pattern__ = r'https?://(?:www\.|m\.)?youtube\.com/(?P<TYPE>user|playlist|view_play_list)(/|.*?[?&](?:list|p)=)(?P<ID>[\w-]+)' + __pattern__ = r'https?://(?:www\.|m\.)?youtube\.com/(?P<TYPE>user|playlist|view_play_list)(/|.*?[?&](?:list|p)=)(?P<ID>[\w\-]+)' __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True ), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True ), ("likes" , "bool", "Grab user (channel) liked videos" , False), diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 2a650768e..fe866563d 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -160,7 +160,8 @@ class Checksum(Addon): return elif check_action == "nothing": return - pyfile.plugin.fail(msg=msg) + + pyfile.plugin.fail(msg) def package_finished(self, pypack): @@ -187,6 +188,7 @@ class Checksum(Addon): local_file = fs_encode(fs_join(download_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) checksum = compute_checksum(local_file, algorithm) + if checksum is data['HASH']: self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') % (data['NAME'], algorithm, checksum)) diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickNLoad.py index aef014d1a..13975ecb5 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickNLoad.py @@ -26,8 +26,8 @@ def forward(source, destination): #@TODO: IPv6 support -class ClickAndLoad(Addon): - __name__ = "ClickAndLoad" +class ClickNLoad(Addon): + __name__ = "ClickNLoad" __type__ = "hook" __version__ = "0.48" __status__ = "testing" diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 32faebbed..09fe59d0a 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -11,7 +11,7 @@ from module.utils import fs_encode, save_join as fs_join class ExternalScripts(Addon): __name__ = "ExternalScripts" __type__ = "hook" - __version__ = "0.48" + __version__ = "0.49" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , True ), @@ -26,7 +26,6 @@ class ExternalScripts(Addon): def init(self): - self.info['oldip'] = None self.scripts = {} self.event_list = ["archive_extract_failed", "archive_extracted" , @@ -115,13 +114,12 @@ class ExternalScripts(Addon): for script in self.scripts['before_reconnect']: args = [ip] self.call(script, args, lock) - self.info['oldip'] = ip def after_reconnect(self, ip, oldip): lock = self.get_config('lock') for script in self.scripts['after_reconnect']: - args = [ip, self.info['oldip']] #@TODO: Use built-in oldip in 0.4.10 + args = [ip, oldip] self.call(script, args, lock) diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index d556537aa..aeb432626 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -3,10 +3,9 @@ from __future__ import with_statement import os +import shutil import time -from shutil import move - from module.plugins.internal.Addon import Addon from module.utils import fs_encode, save_join as fs_join @@ -63,7 +62,7 @@ class HotFolder(Addon): continue newpath = os.path.join(folder, "finished", "tmp_" + f if self.get_config('delete') else f) - move(path, newpath) + shutil.move(path, newpath) self.log_info(_("Added %s from HotFolder") % f) self.pyload.api.addPackage(f, [newpath], 1) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index c84c0439d..6135b3244 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -2,12 +2,12 @@ import pycurl import re +import select import socket import ssl import time import traceback -from select import select from threading import Thread from module.Api import PackageDoesNotExists, FileDoesNotExists @@ -114,7 +114,7 @@ class IRCInterface(Thread, Addon): readbuffer = "" while True: time.sleep(1) - fdset = select([self.sock], [], [], 0) + fdset = select.select([self.sock], [], [], 0) if self.sock not in fdset[0]: continue diff --git a/module/plugins/hooks/LinkdecrypterComHook.py b/module/plugins/hooks/LinkdecrypterComHook.py index 7d39656d3..a318a78fa 100644 --- a/module/plugins/hooks/LinkdecrypterComHook.py +++ b/module/plugins/hooks/LinkdecrypterComHook.py @@ -23,7 +23,7 @@ class LinkdecrypterComHook(Addon): def get_hosters(self): - list = re.search(r'>Supported\(\d+\)</b>: <i>(.[\w.-, ]+)', + list = re.search(r'>Supported\(\d+\)</b>: <i>(.[\w\-., ]+)', self.load("http://linkdecrypter.com/").replace("(g)", "")).group(1).split(', ') try: list.remove("download.serienjunkies.org") diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 929ab9a25..b1e3c8ada 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -5,6 +5,42 @@ import time from module.plugins.internal.Addon import Addon +def get_request(pluginName, account=None): + iface = self.best_interface(pluginName, account) + + if not iface: + return + + iface.useFor(pluginName, account) + requestFactory.iface = lambda: iface.adress + self.log_debug("Using address", iface.adress) + + return oldGetRequest(pluginName, account) + + +class Interface(object): + + def __init__(self, adress): + self.adress = adress + self.history = {} + + + def last_plugin_access(self, pluginName, account): + if (pluginName, account) in self.history: + return self.history[(pluginName, account)] + else: + return 0 + + + def use_for(self, pluginName, account): + self.history[(pluginName, account)] = time.time() + + + def __repr__(self): + return "<Interface - %s>" % self.adress + + + class MultiHome(Addon): __name__ = "MultiHome" __type__ = "hook" @@ -42,44 +78,15 @@ class MultiHome(Addon): def activate(self): requestFactory = self.pyload.requestFactory - oldGetRequest = requestFactory.getRequest - - - def get_request(pluginName, account=None): - iface = self.best_interface(pluginName, account) - if iface: - iface.useFor(pluginName, account) - requestFactory.iface = lambda: iface.adress - self.log_debug("Using address", iface.adress) - return oldGetRequest(pluginName, account) - + oldGetRequest = requestFactory.getRequest requestFactory.getRequest = get_request def best_interface(self, pluginName, account): best = None + for interface in self.interfaces: if not best or interface.lastPluginAccess(pluginName, account) < best.lastPluginAccess(pluginName, account): best = interface - return best - - -class Interface(object): - - def __init__(self, adress): - self.adress = adress - self.history = {} - - def last_plugin_access(self, pluginName, account): - if (pluginName, account) in self.history: - return self.history[(pluginName, account)] - return 0 - - - def use_for(self, pluginName, account): - self.history[(pluginName, account)] = time.time() - - - def __repr__(self): - return "<Interface - %s>" % self.adress + return best diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py index 812b68f76..e1498b0ae 100644 --- a/module/plugins/hooks/RestartFailed.py +++ b/module/plugins/hooks/RestartFailed.py @@ -20,7 +20,7 @@ class RestartFailed(Addon): def periodical(self): - self.log_debug("Restart failed downloads") + self.log_info(_("Restarting all failed downloads...")) self.pyload.api.restartFailed() diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 5f9cfa452..1e0a495b4 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -74,7 +74,7 @@ class SkipRev(Addon): pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.')) for link in self.pyload.api.getPackageData(pyfile.package().id).links: - if link.status == 4 and pyname.match(link.name): + if link.status is 4 and pyname.match(link.name): pylink = self._pyfile(link) if revtokeep > -1 or pyfile.name.endswith(".rev"): diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 04438519b..70bafba67 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -23,9 +23,9 @@ class XFileSharingPro(Hook): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - regexp = {'hoster' : (r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', + regexp = {'hoster' : (r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'), - 'crypter': (r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+', + 'crypter': (r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+', r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')} BUILTIN_HOSTERS = [#WORKING HOSTERS: diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 2ff1755f4..79f72c868 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -14,7 +14,7 @@ class Ftp(Hoster): __version__ = "0.55" __status__ = "testing" - __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' + __pattern__ = r'(?:ftps?|sftp)://([\w\-.]+(:[\w\-.]+)?@)?[\w\-.]+(:\d+)?/.+' __description__ = """Download from ftp directory""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index f92681f60..3301eda7c 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -46,7 +46,7 @@ class LinksnappyCom(MultiHoster): @staticmethod def _get_host(url): host = urlparse.urlsplit(url).netloc - return re.search(r'[\w-]+\.\w+$', host).group(0) + return re.search(r'[\w\-]+\.\w+$', host).group(0) getInfo = create_getInfo(LinksnappyCom) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index d8a29817c..784131842 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -51,7 +51,7 @@ class MegaCoNz(Hoster): __version__ = "0.31" __status__ = "testing" - __pattern__ = r'(https?://(?:www\.)?mega(\.co)?\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,-]+)' + __pattern__ = r'(https?://(?:www\.)?mega(\.co)?\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w\-,]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index a67dca5da..fc20890e4 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -13,7 +13,7 @@ class MegacrypterCom(MegaCoNz): __version__ = "0.23" __status__ = "testing" - __pattern__ = r'https?://\w{0,10}\.?megacrypter\.com/[\w!-]+' + __pattern__ = r'https?://\w{0,10}\.?megacrypter\.com/[\w\-!]+' __description__ = """Megacrypter.com decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index bea04c9cd..a6504025e 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -13,7 +13,7 @@ class NarodRu(SimpleHoster): __version__ = "0.13" __status__ = "testing" - __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+' + __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+\-narod\.yandex\.ru)/(?P<ID>\d+)/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Narod.ru hoster plugin""" @@ -27,7 +27,7 @@ class NarodRu(SimpleHoster): SIZE_REPLACEMENTS = [(u'КБ', 'KB'), (u'МБ', 'MB'), (u'ГБ', 'GB')] URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"), - (r"/start/\d+\.\w+-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)", r"/disk/\1/\2")] + (r"/start/\d+\.\w+\-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)", r"/disk/\1/\2")] CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>' LINK_FREE_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index 431698596..ad0573960 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -24,7 +24,7 @@ class NitroflareCom(SimpleHoster): INFO_PATTERN = r'title="(?P<N>.+?)".+>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>File doesn\'t exist' - LINK_PREMIUM_PATTERN = LINK_FREE_PATTERN = r'(https?://[\w-]+\.nitroflare\.com/.+?)"' + LINK_PREMIUM_PATTERN = LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy" PREMIUM_ONLY_PATTERN = r'This file is available with Premium only' diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py index 842879203..fb552626c 100644 --- a/module/plugins/hoster/OpenloadIo.py +++ b/module/plugins/hoster/OpenloadIo.py @@ -13,7 +13,7 @@ class OpenloadIo(SimpleHoster): __version__ = "0.09" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?openload\.(co|io)/(f|embed)/(?P<ID>[\w-]+)' + __pattern__ = r'https?://(?:www\.)?openload\.(co|io)/(f|embed)/(?P<ID>[\w\-]+)' __description__ = """Openload.co hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/RgHostNet.py b/module/plugins/hoster/RgHostNet.py index 0aa4b7d73..124566b77 100644 --- a/module/plugins/hoster/RgHostNet.py +++ b/module/plugins/hoster/RgHostNet.py @@ -11,7 +11,7 @@ class RgHostNet(SimpleHoster): __version__ = "0.05" __status__ = "testing" - __pattern__ = r'http://(?:www\.)?rghost\.(net|ru)/[\d-]+' + __pattern__ = r'http://(?:www\.)?rghost\.(net|ru)/[\d\-]+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """RgHost.net hoster plugin""" diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index b189ee1ba..a7a45d028 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -12,7 +12,7 @@ class SoundcloudCom(SimpleHoster): __version__ = "0.12" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?soundcloud\.com/[\w-]+/[\w-]+' + __pattern__ = r'https?://(?:www\.)?soundcloud\.com/[\w\-]+/[\w\-]+' __config__ = [("use_premium", "bool" , "Use premium account if available", True ), ("quality" , "Lower;Higher", "Quality" , "Higher")] diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 15b553162..c0bb6a13b 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -13,7 +13,7 @@ class UnibytesCom(SimpleHoster): __version__ = "0.16" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' + __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w\- .]{11}B' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """UniBytes.com hoster plugin""" diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index a5d76763d..b2e5e7321 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -11,7 +11,7 @@ class XFileSharingPro(XFSHoster): __version__ = "0.54" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)' + __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)' __description__ = """XFileSharingPro dummy hoster plugin for hook""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py index 354ba1b4c..418f38926 100644 --- a/module/plugins/hoster/YadiSk.py +++ b/module/plugins/hoster/YadiSk.py @@ -13,7 +13,7 @@ class YadiSk(SimpleHoster): __version__ = "0.06" __status__ = "testing" - __pattern__ = r'https?://yadi\.sk/d/[\w-]+' + __pattern__ = r'https?://yadi\.sk/d/[\w\-]+' __description__ = """Yadi.sk hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 221ec8c42..306ea2fd3 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -81,7 +81,7 @@ class ZippyshareCom(SimpleHoster): return varName #: Handle all getElementById - reVar = r'document.getElementById\(([\'"\w-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?' + reVar = r'document.getElementById\(([\'"\w\-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?' scripts = [re.sub(reVar, repl_element_by_id, script) for script in scripts if script] #: Add try/catch in JS to handle deliberate errors diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index cf3f01df1..ae61acf65 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -23,7 +23,7 @@ def threaded(fn): class Addon(Plugin): __name__ = "Addon" __type__ = "hook" #@TODO: Change to `addon` in 0.4.10 - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __threaded__ = [] #@TODO: Remove in 0.4.10 @@ -46,6 +46,8 @@ class Addon(Plugin): #: List of events the plugin can handle, name the functions exactly like eventname. self.event_list = [] #@NOTE: dont make duplicate entries in event_map + self.info['ip'] = None #@TODO: Remove in 0.4.10 + #: Callback of periodical job task, used by HookManager self.cb = None self.interval = 60 @@ -210,7 +212,8 @@ class Addon(Plugin): #: Deprecated method, use `after_reconnect` instead (Remove in 0.4.10) def afterReconnecting(self, ip): - return self.after_reconnect(ip, None) + self.after_reconnect(ip, self.info['ip']) + self.info['ip'] = ip def captcha_task(self, task): diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py index 28bc47556..51be82bd4 100644 --- a/module/plugins/internal/Base.py +++ b/module/plugins/internal/Base.py @@ -52,7 +52,7 @@ def check_abort(fn): class Base(Plugin): __name__ = "Base" __type__ = "base" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -110,7 +110,7 @@ class Base(Plugin): @classmethod def get_info(cls, url="", html=""): - url = fixurl(url) + url = fixurl(url, unquote=True) info = {'name' : parse_name(url), 'size' : 0, 'status': 3 if url else 8, @@ -378,7 +378,7 @@ class Base(Plugin): def fixurl(self, url, baseurl=None, unquote=True): - url = fixurl(url) + url = fixurl(url, unquote=False) if not baseurl: baseurl = fixurl(self.pyfile.url) diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 9d2aa8b50..d89c3d2c0 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -60,7 +60,7 @@ def fixurl(url, unquote=None): if unquote is None: unquote = newurl == url - newurl = html_unescape(newurl.decode('unicode-escape')) + newurl = html_unescape(decode(newurl).decode('unicode-escape')) newurl = re.sub(r'(?<!:)/{2,}', '/', newurl).strip().lstrip('.') if not unquote: @@ -96,7 +96,7 @@ def str2int(string): t_tuple = [(w, i * 10) for i, w in enumerate(tens)] numwords = dict(o_tuple + t_tuple) - tokens = re.split(r"[\s-]+", string.lower()) + tokens = re.split(r"[\s\-]+", string.lower()) try: return sum(numwords[word] for word in tokens) @@ -226,7 +226,7 @@ def chunks(iterable, size): class Plugin(object): __name__ = "Plugin" __type__ = "plugin" - __version__ = "0.47" + __version__ = "0.48" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -398,7 +398,7 @@ class Plugin(object): self.log_debug("LOAD URL " + url, *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url", "_[1]")]) - url = fixurl(url) #: Recheck in 0.4.10 + url = fixurl(url, unquote=True) #: Recheck in 0.4.10 if req is None: req = self.req or self.pyload.requestFactory.getRequest(self.__name__) diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 39a919ec6..f31a386a7 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -38,7 +38,7 @@ class UnRar(Extractor): re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?', re.I) re_filefixed = re.compile(r'Building (.+)') - re_filelist = re.compile(r'^(.)(\s*[\w.-]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d-]{8}\s+[\d\:]{5}', re.M|re.I) + re_filelist = re.compile(r'^(.)(\s*[\w\-.]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.M|re.I) re_wrongpwd = re.compile(r'password', re.I) re_wrongcrc = re.compile(r'encrypted|damaged|CRC failed|checksum error|corrupt', re.I) |