diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-01-25 17:03:17 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-01-25 17:03:17 +0100 |
commit | 9ceab3d8f9fac0c37cb7b5f7c29a690cdf1abf54 (patch) | |
tree | d4309db3e34500130e6d398ae1be117b97e02c43 /module/plugins/internal | |
parent | more hoster disabled (diff) | |
download | pyload-9ceab3d8f9fac0c37cb7b5f7c29a690cdf1abf54.tar.xz |
fix some hosters, disable some more
Diffstat (limited to 'module/plugins/internal')
-rw-r--r-- | module/plugins/internal/DeadHoster.py | 19 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 21 |
2 files changed, 35 insertions, 5 deletions
diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py new file mode 100644 index 000000000..2de1634b9 --- /dev/null +++ b/module/plugins/internal/DeadHoster.py @@ -0,0 +1,19 @@ +from module.plugins.Hoster import Hoster as _Hoster + +def create_getInfo(plugin): + def getInfo(urls): + for url in urls: + yield '#N/A: ' + url, 0, 1, url + return getInfo + +class Hoster(_Hoster): + __name__ = "DeadHoster" + __type__ = "hoster" + __pattern__ = r"" + __version__ = "0.1" + __description__ = """Hoster is no longer available""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def init(self): + self.fail("Hoster is no longer available")
\ No newline at end of file diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 12b629a81..69909a8a1 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -18,6 +18,7 @@ """ from urlparse import urlparse import re +from time import time from module.plugins.Hoster import Hoster from module.utils import html_unescape, fixup, parseFileSize @@ -36,10 +37,13 @@ def parseHtmlTagAttrValue(attr_name, tag): def parseFileInfo(self, url = '', html = '', infomode = False): if not html and hasattr(self, "html"): html = self.html + info = {"name" : url, "size" : 0, "status" : 3} online = False - if hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html): + if hasattr(self, "req") and self.req.http.code == '404': + info['status'] = 1 + elif hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html): # File offline info['status'] = 1 else: @@ -53,7 +57,8 @@ def parseFileInfo(self, url = '', html = '', infomode = False): if online: # File online, return name and size info['status'] = 2 - if 'N' in info: info['name'] = reSub(info['N'], self.FILE_NAME_REPLACEMENTS) + if 'N' in info: + info['name'] = reSub(info['N'], self.FILE_NAME_REPLACEMENTS) if 'S' in info: size = reSub(info['S'] + info['U'] if 'U' in info else info['S'], self.FILE_SIZE_REPLACEMENTS) info['size'] = parseFileSize(size) @@ -69,10 +74,14 @@ def parseFileInfo(self, url = '', html = '', infomode = False): def create_getInfo(plugin): def getInfo(urls): for url in urls: - file_info = parseFileInfo(plugin, url, getURL(reSub(url, plugin.FILE_URL_REPLACEMENTS), decode=True)) + file_info = parseFileInfo(plugin, url, getURL(reSub(url, plugin.FILE_URL_REPLACEMENTS), \ + decode = False if plugin.HTML_BROKEN_ENCODING else True)) yield file_info return getInfo +def timestamp(): + return int(time()*1000) + class PluginParseError(Exception): def __init__(self, msg): Exception.__init__(self) @@ -82,7 +91,7 @@ class PluginParseError(Exception): class SimpleHoster(Hoster): __name__ = "SimpleHoster" - __version__ = "0.16" + __version__ = "0.17" __pattern__ = None __type__ = "hoster" __description__ = """Base hoster plugin""" @@ -100,13 +109,15 @@ class SimpleHoster(Hoster): FILE_SIZE_REPLACEMENTS = [] FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup)] FILE_URL_REPLACEMENTS = [] + + HTML_BROKEN_ENCODING = False def setup(self): self.resumeDownload = self.multiDL = True if self.account else False def process(self, pyfile): pyfile.url = reSub(pyfile.url, self.FILE_URL_REPLACEMENTS) - self.html = self.load(pyfile.url, decode = True) + self.html = self.load(pyfile.url, decode = False if self.HTML_BROKEN_ENCODING else True) self.file_info = self.getFileInfo() if self.premium: self.handlePremium() |