summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/XFileSharingPro.py
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-09-05 21:39:09 +0200
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-09-05 21:39:09 +0200
commit5b83353447d6cc98e5b16ecac6a1991493626bca (patch)
tree7b7034c061754574255b154dfe815c3efc68290a /module/plugins/hoster/XFileSharingPro.py
parentzippyshare - closed #674 (diff)
downloadpyload-5b83353447d6cc98e5b16ecac6a1991493626bca.tar.xz
update ddlstorage/xfilesharingpro - closed #667
Diffstat (limited to 'module/plugins/hoster/XFileSharingPro.py')
-rw-r--r--module/plugins/hoster/XFileSharingPro.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
index 7ddbeb280..36874b798 100644
--- a/module/plugins/hoster/XFileSharingPro.py
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -34,7 +34,7 @@ class XFileSharingPro(SimpleHoster):
__name__ = "XFileSharingPro"
__type__ = "hoster"
__pattern__ = r"^unmatchable$"
- __version__ = "0.09"
+ __version__ = "0.10"
__description__ = """XFileSharingPro common hoster base"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
@@ -52,7 +52,6 @@ class XFileSharingPro(SimpleHoster):
RECAPTCHA_URL_PATTERN = r'http://[^"\']+?recaptcha[^"\']+?\?k=([^"\']+)"'
CAPTCHA_DIV_PATTERN = r'<b>Enter code.*?<div.*?>(.*?)</div>'
ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</'
- #DIRECT_LINK_PATTERN = r'This direct link.*?href=["\'](.*?)["\']'
def setup(self):
self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern']
@@ -74,25 +73,27 @@ class XFileSharingPro(SimpleHoster):
else:
self.fail("Only premium users can download from other hosters with %s" % self.HOSTER_NAME)
else:
- location = None
+ try:
+ self.html = self.load(pyfile.url, cookies = False, decode = True)
+ self.file_info = self.getFileInfo()
+ except PluginParseError:
+ self.file_info = None
self.req.http.c.setopt(FOLLOWLOCATION, 0)
self.html = self.load(self.pyfile.url, cookies = True, decode = True)
self.header = self.req.http.header
- self.req.http.c.setopt(FOLLOWLOCATION, 1)
-
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+
+ self.location = None
found = re.search("Location\s*:\s*(.*)", self.header, re.I)
if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)):
- location = found.group(1)
- self.html = self.load(pyfile.url, cookies = False, decode = True)
-
- try:
- self.file_info = self.getFileInfo()
- except PluginParseError:
- pyfile.name = html_unescape(unquote(urlparse(location if location else pyfile.url).path.split("/")[-1]))
-
- if location:
- self.startDownload(location)
+ self.location = found.group(1)
+
+ if not self.file_info:
+ pyfile.name = html_unescape(unquote(urlparse(self.location if self.location else pyfile.url).path.split("/")[-1]))
+
+ if self.location:
+ self.startDownload(self.location)
elif self.premium:
self.handlePremium()
else: