diff options
| author | 2011-11-02 15:38:00 +0100 | |
|---|---|---|
| committer | 2011-11-02 15:38:00 +0100 | |
| commit | 64fd5557c19e9819c4912732aaea9e4a230f8995 (patch) | |
| tree | 94a5bcb769270217a3f58c19bd1234794566e906 /module | |
| parent | closed #412, #266 (diff) | |
| download | pyload-64fd5557c19e9819c4912732aaea9e4a230f8995.tar.xz | |
BasePlugin: attempt to fix #266
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/hoster/BasePlugin.py | 34 | ||||
| -rw-r--r-- | module/plugins/hoster/IfolderRu.py | 6 | 
2 files changed, 32 insertions, 8 deletions
| diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 428afeee4..ed11c378b 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -5,12 +5,14 @@ from module.plugins.Hoster import Hoster  from module.utils import html_unescape  from urlparse import urlparse +from re import search +from urllib import unquote  class BasePlugin(Hoster):      __name__ = "BasePlugin"      __type__ = "hoster"      __pattern__ = r"^unmatchable$" -    __version__ = "0.12" +    __version__ = "0.14"      __description__ = """Base Plugin when any other didnt fit"""      __author_name__ = ("RaNaN")      __author_mail__ = ("RaNaN@pyload.org") @@ -39,9 +41,31 @@ class BasePlugin(Hoster):  #  #        return          if pyfile.url.startswith("http"): +            header = self.load(pyfile.url, just_header = True) +            #self.logDebug(header) + +            if 'location' in header: +                self.logDebug("Location: " + header['location']) +                url = unquote(header['location']) +            else: +                url = pyfile.url + +            name = html_unescape(urlparse(url).path.split("/")[-1]) + +            if 'content-disposition' in header: +                self.logDebug("Content-Disposition: " + header['content-disposition']) +                m = search("filename(?P<type>=|\*=(?P<enc>.+)'')(?P<name>.*)", header['content-disposition']) +                if m: +                    disp = m.groupdict() +                    self.logDebug(disp) +                    if not disp['enc']: disp['enc'] = 'utf-8' +                    name = disp['name'].replace('"', "").replace("'", "").replace(";", "").strip() +                    name = unicode(unquote(name), disp['enc']) + +            if not name: self.offline() +            pyfile.name = name +            self.logDebug("Filename: %s" % pyfile.name) +            self.download(url, disposition=True) -            pyfile.name = html_unescape(urlparse(pyfile.url).path.split("/")[-1]) -            self.download(pyfile.url, disposition=True) -                      else: -            self.fail("No Plugin matched and not a downloadable url.") +            self.fail("No Plugin matched and not a downloadable url.")
\ No newline at end of file diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 063ebfbff..c0e45a87a 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -45,14 +45,14 @@ class IfolderRu(Hoster):      __name__ = "IfolderRu"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)?ifolder.ru/(\d+).*" -    __version__ = "0.3" +    __version__ = "0.31"      __description__ = """ifolder.ru"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -    FILE_NAME_PATTERN = ur'^\s*(?:<div><span>)?Название:(?:</span>)? <b>([^<]+)</b><(?:/div|br)>' -    FILE_SIZE_PATTERN = ur'^\s*(?:<div><span>)?Размер:(?:</span>)? <b>([0-9.]+) ([^<]+)</b><(?:/div|br)>' +    FILE_NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>([^<]+)</b><(?:/div|br)>' +    FILE_SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>([0-9.]+) ([^<]+)</b><(?:/div|br)>'      SESSION_ID_PATTERN = r'<a href=(http://ints.ifolder.ru/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>'      FORM1_PATTERN = r'<form method=post name="form1" ID="Form1" style="margin-bottom:200px">(.*?)</form>'      FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' | 
