diff options
-rw-r--r-- | module/plugins/hooks/ExternalScripts.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/BasePlugin.py | 12 | ||||
-rw-r--r-- | module/plugins/hoster/Ftp.py | 12 | ||||
-rw-r--r-- | module/plugins/hoster/GoogledriveCom.py | 14 | ||||
-rw-r--r-- | module/plugins/hoster/OneFichierCom.py | 14 | ||||
-rw-r--r-- | module/plugins/hoster/TusfilesNet.py | 6 | ||||
-rw-r--r-- | module/plugins/hoster/UlozTo.py | 13 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 17 |
8 files changed, 43 insertions, 47 deletions
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 9324e306e..be0857009 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -10,7 +10,7 @@ from module.utils import fs_encode, save_join class ExternalScripts(Hook): __name__ = "ExternalScripts" __type__ = "hook" - __version__ = "0.38" + __version__ = "0.39" __config__ = [("activated", "bool", "Activated" , True ), ("waitend" , "bool", "Wait script ending", False)] diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index bd73a72b0..418f446eb 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -13,7 +13,7 @@ from module.plugins.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.41" __pattern__ = r'^unmatchable$' @@ -41,6 +41,16 @@ class BasePlugin(Hoster): self.resumeDownload = True + #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 + def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): + try: + if disposition: + content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') + self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name + finally: + return super(BasePlugin, self).download(url, get, post, ref, cookies, False) + + def process(self, pyfile): """main function""" diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 22fc5f67a..cfe230f42 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -12,7 +12,7 @@ from module.plugins.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.46" + __version__ = "0.49" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -28,6 +28,16 @@ class Ftp(Hoster): self.resumeDownload = True + #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 + def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): + try: + if disposition: + content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') + self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name + finally: + return super(Ftp, self).download(url, get, post, ref, cookies, False) + + def process(self, pyfile): parsed_url = urlparse(pyfile.url) netloc = parsed_url.netloc diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 57a5ab7fb..66f36e6c0 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.07" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -22,8 +22,6 @@ class GoogledriveCom(SimpleHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - DISPOSITION = False #: Remove in 0.4.10 - NAME_PATTERN = r'"og:title" content="(?P<N>.*?)">' OFFLINE_PATTERN = r'align="center"><p class="errorMessage"' @@ -34,16 +32,6 @@ class GoogledriveCom(SimpleHoster): self.chunkLimit = 1 - #@NOTE: Temp work-around to `Content-Disposition=filename*=UTF-8` bug! - def handleDirect(self, pyfile): - self.link = self.directLink(pyfile.url, self.resumeDownload) - - if self.link: - remote = urllib2.urlopen(self.link) - name = remote.info()['Content-Disposition'].split(';') - pyfile.name = name[1].split('filename=')[1][1:] - - def handleFree(self, pyfile): try: link1 = re.search(r'"(https://docs.google.com/uc\?id.*?export=download)",', diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 0c26d4277..8a5fa9cae 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import re -import urllib2 from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -9,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.81" + __version__ = "0.83" __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -32,7 +31,6 @@ class OneFichierCom(SimpleHoster): OFFLINE_PATTERN = r'File not found !\s*<' COOKIES = [("1fichier.com", "LG", "en")] - DISPOSITION = False #: Remove in 0.4.10 WAIT_PATTERN = r'>You must wait \d+ minutes' @@ -42,16 +40,6 @@ class OneFichierCom(SimpleHoster): self.resumeDownload = True - #@NOTE: Temp work-around to `Content-Disposition=filename*=UTF-8` bug! - def handleDirect(self, pyfile): - self.link = self.directLink(pyfile.url, self.resumeDownload) - - if self.link: - remote = urllib2.urlopen(self.link) - name = remote.info()['Content-Disposition'].split(';') - pyfile.name = name[1].split('filename=')[1][1:] - - def handleFree(self, pyfile): id = self.info['pattern']['ID1'] or self.info['pattern']['ID2'] url, inputs = self.parseHtmlForm('action="https://1fichier.com/\?%s' % id) diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py index 9fdb6eae1..6021a4c30 100644 --- a/module/plugins/hoster/TusfilesNet.py +++ b/module/plugins/hoster/TusfilesNet.py @@ -7,7 +7,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class TusfilesNet(XFSHoster): __name__ = "TusfilesNet" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/\w{12}' @@ -27,9 +27,9 @@ class TusfilesNet(XFSHoster): self.resumeDownload = True - def downloadLink(self, link): + def downloadLink(self, link, disposition=True): try: - return super(TusfilesNet, self).downloadLink(link) + return super(TusfilesNet, self).downloadLink(link, disposition) except BadHeader, e: if e.code is 503: diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 49ed598cb..c48873387 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -15,7 +15,7 @@ def convertDecimalPrefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.06" + __version__ = "1.08" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -34,7 +34,6 @@ class UlozTo(SimpleHoster): SIZE_REPLACEMENTS = [(r'([\d.]+)\s([kMG])B', convertDecimalPrefix)] CHECK_TRAFFIC = True - DISPOSITION = False #: Remove in 0.4.10 ADULT_PATTERN = r'<form action="(.+?)" method="post" id="frm-askAgeForm">' PASSWD_PATTERN = r'<div class="passwordProtectedFile">' @@ -48,16 +47,6 @@ class UlozTo(SimpleHoster): self.resumeDownload = True - #@NOTE: Temp work-around to `Content-Disposition=filename*=UTF-8` bug! - def handleDirect(self, pyfile): - self.link = self.directLink(pyfile.url, self.resumeDownload) - - if self.link: - remote = urllib2.urlopen(self.link) - name = remote.info()['Content-Disposition'].split(';') - pyfile.name = name[1].split('filename=')[1][1:] - - def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"') if not action or not inputs: diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index f9a273d5e..6f1c7409d 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -5,6 +5,7 @@ import mimetypes import os import re import time +import urllib2 from inspect import isclass from urllib import unquote @@ -246,7 +247,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.31" + __version__ = "1.33" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -308,7 +309,7 @@ class SimpleHoster(Hoster): DIRECT_LINK = None #: Set to True to looking for direct link (as defined in handleDirect method), set to None to do it if self.account is True else False MULTI_HOSTER = False #: Set to True to leech other hoster link (as defined in handleMulti method) LOGIN_ACCOUNT = False #: Set to True to require account login - DISPOSITION = True #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 + DISPOSITION = True #: Set to True to use any content-disposition value in http header as file name directLink = getFileURL #@TODO: Remove in 0.4.10 @@ -486,7 +487,7 @@ class SimpleHoster(Hoster): self.logDebug("Handled as free download") self.handleFree(pyfile) - self.downloadLink(self.link, self.DISPOSITION) #: Remove `self.DISPOSITION` in 0.4.10 + self.downloadLink(self.link, self.DISPOSITION) self.checkFile() except Fail, e: #@TODO: Move to PluginThread in 0.4.10 @@ -497,6 +498,16 @@ class SimpleHoster(Hoster): raise Fail(e) + #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 + def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): + try: + if disposition: + content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') + self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name + finally: + return super(SimpleHoster, self).download(url, get, post, ref, cookies, False) + + def downloadLink(self, link, disposition=True): if link and isinstance(link, basestring): self.correctCaptcha() |