From a0805f27015748638a5fb05fd55b746852c53362 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 15 Jun 2011 17:35:48 +0200 Subject: html_unescape function, little plugin improvements --- module/plugins/hoster/FreakshareCom.py | 5 +++++ module/plugins/hoster/MegauploadCom.py | 12 +++++++----- module/plugins/hoster/RapidshareCom.py | 6 ++---- module/plugins/hoster/YoutubeCom.py | 4 +++- 4 files changed, 17 insertions(+), 10 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index c20206bf5..869b8a99e 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -34,6 +34,11 @@ class FreakshareCom(Hoster): self.get_file_url() self.download(self.pyfile.url, post=self.req_opts) + + + check = self.checkDownload({"bad": "bad try"}) + if check == "bad": + self.fail("Bad Try.") def prepare(self): diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index fa16fdf31..342a8024d 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -7,7 +7,7 @@ from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL -from module.unescape import unescape +from module.utils import html_unescape from module.PyFile import statusMap from pycurl import error @@ -36,7 +36,7 @@ def getInfo(urls): # File info fileInfo = _translateAPIFileInfo(apiFileId, apiFileDataMap, apiHosterMap) url = urls[i] - name = fileInfo.get('name', url) + name = html_unescape(fileInfo.get('name', url)) size = fileInfo.get('size', 0) status = fileInfo.get('status', statusMap['queued']) @@ -51,7 +51,7 @@ def _translateAPIFileInfo(apiFileId, apiFileDataMap, apiHosterMap): fileInfo = {} try: fileInfo['status'] = MegauploadCom.API_STATUS_MAPPING[apiFileDataMap[apiFileId]] - fileInfo['name'] = apiFileDataMap['n'] + fileInfo['name'] = apiFileDataMap['n'] fileInfo['size'] = int(apiFileDataMap['s']) fileInfo['hoster'] = apiHosterMap[apiFileDataMap['d']] except: @@ -215,10 +215,12 @@ class MegauploadCom(Hoster): def get_file_name(self): try: - return self.api["name"] + name = self.api["name"] except KeyError: file_name_pattern = 'id="downloadlink">