diff options
25 files changed, 65 insertions, 62 deletions
diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py index b62d0beb9..8888dc4e6 100644 --- a/module/plugins/Crypter.py +++ b/module/plugins/Crypter.py @@ -18,7 +18,7 @@ class Crypter(Plugin): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - html = None + html = None #: last html loaded def __init__(self, pyfile): diff --git a/module/plugins/Hoster.py b/module/plugins/Hoster.py index 22e8dbfcb..86e26dfae 100644 --- a/module/plugins/Hoster.py +++ b/module/plugins/Hoster.py @@ -21,4 +21,4 @@ class Hoster(Plugin): __authors__ = [("mkaay", "mkaay@mkaay.de")] - html = None + html = None #: last html loaded diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 8855e5980..91bf3aab9 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -161,6 +161,9 @@ class Plugin(Base): ("mkaay", "mkaay@mkaay.de")] + info = {} #: file info dict + + def __init__(self, pyfile): Base.__init__(self, pyfile.m.core) diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index f858da9d8..91318eadf 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -9,7 +9,7 @@ class LinkdecrypterCom(Crypter): __type__ = "crypter" __version__ = "0.27" - __pattern__ = None + __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 8c51fbac4..9d51b5036 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): __name__ = "DateiTo" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' @@ -29,7 +29,7 @@ class DateiTo(SimpleHoster): def handleFree(self): url = 'http://datei.to/ajax/download.php' - data = {'P': 'I', 'ID': self.file_info['ID']} + data = {'P': 'I', 'ID': self.info['ID']} recaptcha = ReCaptcha(self) for _i in xrange(10): diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 2f6d4b378..1cfddd64d 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.61" + __version__ = "0.62" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' @@ -42,7 +42,7 @@ class ExtabitCom(SimpleHoster): self.logDebug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) - fileID = m.group('ID') if m else self.file_info('ID') + fileID = m.group('ID') if m else self.info('ID') m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html) if m: diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index a5469ceb9..f31be155d 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+).*' @@ -39,7 +39,7 @@ class FilecloudIo(SimpleHoster): def handleFree(self): - data = {"ukey": self.file_info['ID']} + data = {"ukey": self.info['ID']} m = re.search(self.AB1_PATTERN, self.html) if m is None: @@ -94,12 +94,12 @@ class FilecloudIo(SimpleHoster): if response['dl']: self.html = self.load('http://filecloud.io/download.html') - m = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) + m = re.search(self.LINK_PATTERN % self.info['ID'], self.html) if m is None: self.error(_("LINK_PATTERN not found")) - if "size" in self.file_info and self.file_info['size']: - self.check_data = {"size": int(self.file_info['size'])} + if "size" in self.info and self.info['size']: + self.check_data = {"size": int(self.info['size'])} download_url = m.group(1) self.download(download_url) @@ -109,7 +109,7 @@ class FilecloudIo(SimpleHoster): def handlePremium(self): akey = self.account.getAccountData(self.user)['akey'] - ukey = self.file_info['ID'] + ukey = self.info['ID'] self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey)) rep = self.load("http://api.filecloud.io/api-fetch_download_url.api", post={"akey": akey, "ukey": ukey}) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index b31500b0e..7691a1d00 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -15,8 +15,7 @@ def getInfo(urls): if m and not re.match(m.group(1), FilefactoryCom.__pattern__): #: It's a direct link! Skipping yield (url, 0, 3, url) else: #: It's a standard html page - file_info = parseFileInfo(FilefactoryCom, url, getURL(url)) - yield file_info + yield parseFileInfo(FilefactoryCom, url, getURL(url)) class FilefactoryCom(SimpleHoster): diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 4439949f0..2ab65ae99 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -10,14 +10,11 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): for url in urls: - html = getURL('http://www.fshare.vn/check_link.php', post={ - "action": "check_link", - "arrlinks": url - }, decode=True) - - file_info = parseFileInfo(FshareVn, url, html) + html = getURL("http://www.fshare.vn/check_link.php", + post={'action': "check_link", 'arrlinks': url}, + decode=True) - yield file_info + yield parseFileInfo(FshareVn, url, html) def doubleDecode(m): diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index 2ca506cf7..3ccd5c172 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class KingfilesNet(SimpleHoster): __name__ = "KingfilesNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' @@ -38,7 +38,7 @@ class KingfilesNet(SimpleHoster): # Click the free user button post_data = {'op': "download1", 'usr_login': "", - 'id': file_info['ID'], + 'id': self.info['ID'], 'fname': self.pyfile.name, 'referer': "", 'method_free': "+"} diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 33a1ad71d..3ed1199f6 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -37,10 +37,12 @@ def checkHTMLHeader(url): def getInfo(urls): for url in urls: location, status = checkHTMLHeader(url) + if status: file_info = (url, 0, status, url) else: file_info = parseFileInfo(MediafireCom, url, getURL(url, decode=True)) + yield file_info diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index a40f26ab0..b3100b6d4 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -13,10 +13,10 @@ def getInfo(urls): h.c.setopt(HTTPHEADER, ["Accept: text/html", "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"]) + for url in urls: html = h.load(url, decode=True) - file_info = parseFileInfo(MegaRapidCz, url, html) - yield file_info + yield parseFileInfo(MegaRapidCz, url, html) class MegaRapidCz(SimpleHoster): diff --git a/module/plugins/hoster/NowVideoAt.py b/module/plugins/hoster/NowVideoAt.py index 04308d7dd..bcf3165d2 100644 --- a/module/plugins/hoster/NowVideoAt.py +++ b/module/plugins/hoster/NowVideoAt.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NowVideoAt(SimpleHoster): __name__ = "NowVideoAt" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|sx)/(video|mobile/#/videos)/(?P<ID>\w+)' @@ -31,7 +31,7 @@ class NowVideoAt(SimpleHoster): def handleFree(self): - self.html = self.load("http://www.nowvideo.at/mobile/video.php", get={'id': self.file_info['ID']}) + self.html = self.load("http://www.nowvideo.at/mobile/video.php", get={'id': self.info['ID']}) m = re.search(self.LINK_PATTERN, self.html) if m is None: diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index 595ac02b4..70abdfcc2 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -9,7 +9,7 @@ class PremiumizeMe(Hoster): __type__ = "hoster" __version__ = "0.12" - __pattern__ = None #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady + __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady __description__ = """Premiumize.me hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 93e037664..c9d1ede34 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -17,7 +17,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' @@ -42,7 +42,7 @@ class TurbobitNet(SimpleHoster): def handleFree(self): - self.url = "http://turbobit.net/download/free/%s" % self.file_info['ID'] + self.url = "http://turbobit.net/download/free/%s" % self.info['ID'] self.html = self.load(self.url, ref=True, decode=True) rtUpdate = self.getRtUpdate() @@ -130,7 +130,7 @@ class TurbobitNet(SimpleHoster): for b in [1, 3]: self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % ( - self.file_info['ID'], b, quote(fun), rtUpdate) + self.info['ID'], b, quote(fun), rtUpdate) try: out = self.js.eval(self.jscode) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 319cc1728..e4b28e81d 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -73,7 +73,7 @@ class UlozTo(SimpleHoster): if re.search(self.VIPLINK_PATTERN, self.html): self.html = self.load(pyfile.url, get={"disclaimer": "1"}) - self.file_info = self.getFileInfo() + self.getFileInfo() if self.premium and self.checkTrafficLeft(): self.handlePremium() diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 12b4af0b7..be9b2bc00 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t class UploadingCom(SimpleHoster): __name__ = "UploadingCom" __type__ = "hoster" - __version__ = "0.37" + __version__ = "0.38" __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' @@ -37,7 +37,7 @@ class UploadingCom(SimpleHoster): pyfile.url = pyfile.url.replace("/files", "/files/get") self.html = self.load(pyfile.url, decode=True) - self.file_info = self.getFileInfo() + self.getFileInfo() if self.premium: self.handlePremium() @@ -47,7 +47,7 @@ class UploadingCom(SimpleHoster): def handlePremium(self): postData = {'action': 'get_link', - 'code': self.file_info['ID'], + 'code': self.info['ID'], 'pass': 'undefined'} self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData) @@ -70,7 +70,7 @@ class UploadingCom(SimpleHoster): self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = self.pyfile.url - response = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.file_info['ID']})) + response = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['ID']})) if 'answer' in response and 'wait_time' in response['answer']: wait_time = int(response['answer']['wait_time']) self.logInfo(_("Waiting %d seconds") % wait_time) @@ -79,7 +79,7 @@ class UploadingCom(SimpleHoster): self.error(_("No AJAX/WAIT")) response = json_loads( - self.load(ajax_url, post={'action': 'get_link', 'code': self.file_info['ID'], 'pass': 'false'})) + self.load(ajax_url, post={'action': 'get_link', 'code': self.info['ID'], 'pass': 'false'})) if 'answer' in response and 'link' in response['answer']: url = response['answer']['link'] else: diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index 51e4ec8b8..cd43de2bb 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -2,22 +2,22 @@ import re -from module.network.RequestFactory import getRequest +from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster def getInfo(urls): - h = getRequest() for url in urls: - h.load(url) fid = re.search(WebshareCz.__pattern__, url).group('ID') - api_data = h.load('https://webshare.cz/api/file_info/', post={'ident': fid}) + api_data = getURL("https://webshare.cz/api/file_info/", post={'ident': fid}) + if 'File not found' in api_data: file_info = (url, 0, 1, url) else: name = re.search('<name>(.+)</name>', api_data).group(1) size = re.search('<size>(.+)</size>', api_data).group(1) file_info = (name, size, 2, url) + yield file_info diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index f34c23c3b..3b5e6df33 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" __pattern__ = r'(?P<HOST>http://www\d{0,2}\.zippyshare\.com)/v(?:/|iew\.jsp.*key=)(?P<KEY>\d+)' @@ -49,8 +49,8 @@ class ZippyshareCom(SimpleHoster): def get_link(self): checksum = self.get_checksum() - p_url = path.join("d", self.file_info['KEY'], str(checksum), self.pyfile.name) - dl_link = urljoin(self.file_info['HOST'], p_url) + p_url = path.join("d", self.info['KEY'], str(checksum), self.pyfile.name) + dl_link = urljoin(self.info['HOST'], p_url) return dl_link diff --git a/module/plugins/internal/DeadCrypter.py b/module/plugins/internal/DeadCrypter.py index 91cdf6036..4c635e366 100644 --- a/module/plugins/internal/DeadCrypter.py +++ b/module/plugins/internal/DeadCrypter.py @@ -8,7 +8,7 @@ class DeadCrypter(_Crypter): __type__ = "crypter" __version__ = "0.02" - __pattern__ = None + __pattern__ = r'^unmatchable$' __description__ = """ Crypter is no longer available """ __license__ = "GPLv3" diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py index 2d91b1d2d..b78068069 100644 --- a/module/plugins/internal/DeadHoster.py +++ b/module/plugins/internal/DeadHoster.py @@ -16,7 +16,7 @@ class DeadHoster(_Hoster): __type__ = "hoster" __version__ = "0.12" - __pattern__ = None + __pattern__ = r'^unmatchable$' __description__ = """ Hoster is no longer available """ __license__ = "GPLv3" diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 9856ae2e5..0985bac60 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -13,9 +13,9 @@ from module.utils import fixup, html_unescape class SimpleCrypter(Crypter): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.25" + __version__ = "0.26" - __pattern__ = None + __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] @@ -71,6 +71,8 @@ class SimpleCrypter(Crypter): #@TODO: remove in 0.4.10 def init(self): + self.info = {} + account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "") account = self.core.accountManager.getAccountPlugin(account_name) @@ -126,17 +128,17 @@ class SimpleCrypter(Crypter): if name and name != url: self.pyfile.name = name else: - self.pyfile.name = self.file_info['name'] = html_unescape(urlparse(url).path.split("/")[-1]) + self.pyfile.name = self.info['name'] = html_unescape(urlparse(url).path.split("/")[-1]) - if status == 1: + if status is 1: self.offline() - elif status == 6: + elif status is 6: self.tempOffline() - self.file_info['folder'] = self.pyfile.name + self.info['folder'] = self.pyfile.name self.logDebug("FILE NAME: %s" % self.pyfile.name) - return self.file_info + return self.info def getLinks(self): diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 1555151a5..1f673a5c2 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -155,14 +155,14 @@ def parseFileInfo(self, url="", html=""): if not hasattr(self, "info"): self.info = {} - try: #: Remove try-except statement in 0.4.10 + try: self.logDebug(_("File info (before update): %s") % self.info) except: pass self.info.update(info) - try: #: Remove try-except statement in 0.4.10 + try: self.logDebug(_("File info (after update): %s") % self.info) except: pass @@ -255,7 +255,7 @@ class SimpleHoster(Hoster): FORCE_CHECK_TRAFFIC = False #: Set to True to force checking traffic left for premium account - def init(): + def init(self): self.info = {} @@ -330,11 +330,11 @@ class SimpleHoster(Hoster): else: self.pyfile.name = self.info['name'] = html_unescape(urlparse(url).path.split("/")[-1]) - if status == 1: + if status is 1: self.offline() - elif status == 6: + elif status is 6: self.tempOffline() - elif status != 2: + elif status is not 2: self.error(_("File info: %s") % self.info) if size: diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index 5a126707b..2e491050b 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -8,7 +8,7 @@ class XFSCrypter(SimpleCrypter): __type__ = "crypter" __version__ = "0.03" - __pattern__ = None + __pattern__ = r'^unmatchable$' __description__ = """XFileSharing decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 838af9102..a2e4f5846 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -17,7 +17,7 @@ class XFSHoster(SimpleHoster): __type__ = "hoster" __version__ = "0.09" - __pattern__ = None + __pattern__ = r'^unmatchable$' __description__ = """XFileSharing hoster plugin""" __license__ = "GPLv3" |