diff options
Diffstat (limited to 'module/plugins/hoster/XFileSharingPro.py')
-rw-r--r-- | module/plugins/hoster/XFileSharingPro.py | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 5b167c3c9..c4c05f604 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -1,27 +1,27 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. - - @author: zoidberg -""" +############################################################################### +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, +# or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see <http://www.gnu.org/licenses/>. +# +# @author: zoidberg +############################################################################### import re from random import random from urllib import unquote from urlparse import urlparse from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError, replace_patterns from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia from module.utils import html_unescape from module.network.RequestFactory import getURL @@ -36,7 +36,7 @@ class XFileSharingPro(SimpleHoster): __name__ = "XFileSharingPro" __type__ = "hoster" __pattern__ = r"^unmatchable$" - __version__ = "0.25" + __version__ = "0.27" __description__ = """XFileSharingPro common hoster base""" __author_name__ = ("zoidberg", "stickell") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") @@ -44,10 +44,10 @@ class XFileSharingPro(SimpleHoster): FILE_NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"' FILE_SIZE_PATTERN = r'You have requested <font color="red">[^<]+</font> \((?P<S>[^<]+)\)</font>' FILE_INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>' - FILE_OFFLINE_PATTERN = r'<(b|h[1-6])>File Not Found</(b|h[1-6])>|This file has been removed' + FILE_OFFLINE_PATTERN = r'>\w+ (Not Found|file (was|has been) removed)' WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>' - LONG_WAIT_PATTERN = r'(?P<H>\d+(?=\s*hour))?.*?(?P<M>\d+(?=\s*minute))?.*?(?P<S>\d+(?=\s*second))?' + #LONG_WAIT_PATTERN = r'(?P<H>\d+(?=\s*hour))?.*?(?P<M>\d+(?=\s*minute))?.*?(?P<S>\d+(?=\s*second))?' OVR_DOWNLOAD_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)' OVR_KILL_LINK_PATTERN = r'<h2>Delete Link</h2>\s*<textarea[^>]*>([^<]+)' CAPTCHA_URL_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)' @@ -68,7 +68,9 @@ class XFileSharingPro(SimpleHoster): def process(self, pyfile): self.prepare() - if not re.match(self.__pattern__, self.pyfile.url): + pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) + + if not re.match(self.__pattern__, pyfile.url): if self.premium: self.handleOverriden() else: @@ -128,7 +130,7 @@ class XFileSharingPro(SimpleHoster): self.startDownload(url) def getDownloadLink(self): - for i in range(5): + for i in xrange(5): self.logDebug("Getting download link: #%d" % i) data = self.getPostParameters() @@ -223,8 +225,8 @@ class XFileSharingPro(SimpleHoster): self.setWait(3600, True) self.wait() self.retry(25) - elif 'countdown' in self.errmsg or 'Expired session' in self.errmsg: - self.retry(3) + elif 'countdown' in self.errmsg or 'Expired' in self.errmsg: + self.retry() elif 'maintenance' in self.errmsg: self.tempOffline() elif 'download files up to' in self.errmsg: @@ -238,7 +240,7 @@ class XFileSharingPro(SimpleHoster): return self.errmsg def getPostParameters(self): - for _ in range(3): + for _ in xrange(3): if not self.errmsg: self.checkErrors() |