summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-31 23:58:33 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-31 23:58:33 +0200
commitfcaf6c9e4c5c618b8c2741ca7ee5676787b4c3f0 (patch)
tree4f325a9b18d2a5a7d8670c068c7bae1977be6d5d
parent[TusfilesNet] Fix downloadLink (diff)
downloadpyload-fcaf6c9e4c5c618b8c2741ca7ee5676787b4c3f0.tar.xz
Temp fixup to `filename*=UTF-8` bug
-rw-r--r--module/plugins/hoster/BasePlugin.py12
-rw-r--r--module/plugins/hoster/Ftp.py12
-rw-r--r--module/plugins/hoster/GoogledriveCom.py14
-rw-r--r--module/plugins/hoster/OneFichierCom.py14
-rw-r--r--module/plugins/hoster/UlozTo.py13
-rw-r--r--module/plugins/internal/SimpleHoster.py17
6 files changed, 39 insertions, 43 deletions
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py
index bd73a72b0..8da7ff5df 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.39"
__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(self.link).info()['Content-Disposition'].split(';')
+ self.pyfile.name = content[1].split('filename=')[1][1:-1]
+ finally:
+ return super(SimpleHoster, 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..370dc7b0f 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.47"
__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(self.link).info()['Content-Disposition'].split(';')
+ self.pyfile.name = content[1].split('filename=')[1][1:-1]
+ finally:
+ return super(SimpleHoster, 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 bb4a5d1d4..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.06"
+ __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:-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 6803bc91c..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.82"
+ __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:-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/UlozTo.py b/module/plugins/hoster/UlozTo.py
index c6dcec2cf..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.07"
+ __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:-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..9f3e56eb8 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.32"
__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(self.link).info()['Content-Disposition'].split(';')
+ self.pyfile.name = content[1].split('filename=')[1][1:-1]
+ 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()