summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-15 22:24:08 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-24 22:38:47 +0200
commitaeba469412a08a52f8fcd61b02dd5b9e481a4dff (patch)
tree83c2aabcd1a62e128d1ff5233a3ba863ecfc3ba1 /module/plugins/internal
parent[NitroflareComFolder] Fixup (diff)
downloadpyload-aeba469412a08a52f8fcd61b02dd5b9e481a4dff.tar.xz
[SimpleHoster] fixurl
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/SimpleCrypter.py14
-rw-r--r--module/plugins/internal/SimpleHoster.py25
-rw-r--r--module/plugins/internal/XFSHoster.py1
3 files changed, 20 insertions, 20 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 6a339b46e..3e8b89f79 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
import re
-import urlparse
from module.plugins.internal.Crypter import Crypter
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies
@@ -11,7 +10,7 @@ from module.utils import fixup, html_unescape
class SimpleCrypter(Crypter, SimpleHoster):
__name__ = "SimpleCrypter"
__type__ = "crypter"
- __version__ = "0.54"
+ __version__ = "0.55"
__pattern__ = r'^unmatchable$'
__config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package']
@@ -108,13 +107,13 @@ class SimpleCrypter(Crypter, SimpleHoster):
self.handleDirect(pyfile)
if self.link:
- self.urls = [self.link]
+ self.urls = self.fixurls([self.link])
else:
self.preload()
self.checkInfo()
- self.links = self.getLinks() or list()
+ self.links = self.fixurls(self.getLinks()) or list()
if hasattr(self, 'PAGES_PATTERN') and hasattr(self, 'loadPage'):
self.handlePages(pyfile)
@@ -122,7 +121,6 @@ class SimpleCrypter(Crypter, SimpleHoster):
self.logDebug("Package has %d links" % len(self.links))
if self.links:
- self.links = [html_unescape(l.decode('unicode-escape').strip()) for l in self.links] #@TODO: Move to Crypter in 0.4.10
self.packages = [(self.info['name'], self.links, self.info['folder'])]
elif not self.urls and not self.packages: #@TODO: Remove in 0.4.10
@@ -159,11 +157,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
Returns the links extracted from self.html
You should override this only if it's impossible to extract links using only the LINK_PATTERN.
"""
- url_p = urlparse.urlparse(self.pyfile.url)
- baseurl = "%s://%s" % (url_p.scheme, url_p.netloc)
-
- return [urlparse.urljoin(baseurl, link) if not urlparse.urlparse(link).scheme else link \
- for link in re.findall(self.LINK_PATTERN, self.html)]
+ return re.findall(self.LINK_PATTERN, self.html)
def handlePages(self, pyfile):
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 58d8158ca..cec5f55f1 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -229,7 +229,7 @@ def secondsToMidnight(gmt=0):
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "1.68"
+ __version__ = "1.69"
__pattern__ = r'^unmatchable$'
__config__ = [("use_premium", "bool", "Use premium account if available" , True),
@@ -517,20 +517,27 @@ class SimpleHoster(Hoster):
raise Fail(err)
+ def fixurl(self, url):
+ return self.fixurls([url])[0]
+
+
+ def fixurls(self, urls):
+ url_p = urlparse.urlparse(self.pyfile.url)
+ baseurl = "%s://%s" % (url_p.scheme, url_p.netloc)
+
+ urls = (html_unescape(url.decode('unicode-escape').strip()) for url in urls)
+
+ return [urlparse.urljoin(baseurl, url) if not urlparse.urlparse(url).scheme else url \
+ for url in urls]
+
+
def download(self, url, *args, **kwargs):
if not url or not isinstance(url, basestring):
return
self.correctCaptcha()
- url = html_unescape(url.decode('unicode-escape').strip()) #@TODO: Move to Hoster in 0.4.10
-
- if not urlparse.urlparse(url).scheme:
- url_p = urlparse.urlparse(self.pyfile.url)
- baseurl = "%s://%s" % (url_p.scheme, url_p.netloc)
- url = urlparse.urljoin(baseurl, url)
-
- return super(SimpleHoster, self).download(url, *args, **kwargs)
+ return super(SimpleHoster, self).download(self.fixurl(url), *args, **kwargs)
def checkFile(self):
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 0591f1baf..b2642bf1a 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -3,7 +3,6 @@
import pycurl
import random
import re
-import urlparse
from module.plugins.internal.ReCaptcha import ReCaptcha
from module.plugins.internal.SolveMedia import SolveMedia