summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-23 13:26:32 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-23 13:26:32 +0100
commite1d4186c62512d8bb76d35b6f8d1828d8d0aa94e (patch)
treee78b3eb323135b0fcb10577bda0b6ddf7181070f /module/plugins
parentNew plugin: MultiHoster (diff)
downloadpyload-e1d4186c62512d8bb76d35b6f8d1828d8d0aa94e.tar.xz
[SimpleHoster] Improve multi-hoster feature
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/crypter/NetfolderIn.py6
-rw-r--r--module/plugins/hoster/BitshareCom.py2
-rw-r--r--module/plugins/hoster/CzshareCom.py20
-rw-r--r--module/plugins/hoster/DebridItaliaCom.py4
-rw-r--r--module/plugins/hoster/MediafireCom.py4
-rw-r--r--module/plugins/hoster/MegaRapidCz.py4
-rw-r--r--module/plugins/hoster/RarefileNet.py4
-rw-r--r--module/plugins/hoster/TusfilesNet.py4
-rw-r--r--module/plugins/internal/SimpleHoster.py38
-rw-r--r--module/plugins/internal/XFSHoster.py5
10 files changed, 47 insertions, 44 deletions
diff --git a/module/plugins/crypter/NetfolderIn.py b/module/plugins/crypter/NetfolderIn.py
index bfdf5cb82..62dc5c914 100644
--- a/module/plugins/crypter/NetfolderIn.py
+++ b/module/plugins/crypter/NetfolderIn.py
@@ -10,7 +10,7 @@ class NetfolderIn(SimpleCrypter):
__type__ = "crypter"
__version__ = "0.72"
- __pattern__ = r'http://(?:www\.)?netfolder\.in/((?P<id1>\w+)/\w+|folder\.php\?folder_id=(?P<id2>\w+))'
+ __pattern__ = r'http://(?:www\.)?netfolder\.in/(folder\.php\?folder_id=)?(?P<ID>\w+)(?(1)|/\w+)'
__config__ = [("use_subfolder", "bool", "Save package to subfolder", True),
("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
@@ -43,8 +43,8 @@ class NetfolderIn(SimpleCrypter):
def submitPassword(self):
# Gather data
try:
- m = re.match(self.__pattern__, self.pyfile.url)
- id = max(m.group('id1'), m.group('id2'))
+ m = re.match(self.__pattern__, self.pyfile.url)
+ id = m.group('ID')
except AttributeError:
self.logDebug("Unable to get package id from url [%s]" % self.pyfile.url)
return
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index 6a497f4bc..a4fbde048 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -13,7 +13,7 @@ class BitshareCom(SimpleHoster):
__type__ = "hoster"
__version__ = "0.51"
- __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P<id1>\w+)(/(?P<NAME>.*?)\.html)?|\?f=(?P<id2>\w+))'
+ __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.*?)\.html)'
__description__ = """Bitshare.com hoster plugin"""
__license__ = "GPLv3"
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py
index 72f1bb45d..914849879 100644
--- a/module/plugins/hoster/CzshareCom.py
+++ b/module/plugins/hoster/CzshareCom.py
@@ -12,7 +12,7 @@ from module.utils import parseFileSize
class CzshareCom(SimpleHoster):
__name__ = "CzshareCom"
__type__ = "hoster"
- __version__ = "0.95"
+ __version__ = "0.96"
__pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).*'
@@ -21,21 +21,21 @@ class CzshareCom(SimpleHoster):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>'
- SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[\d .,]+)(?P<U>[\w^_]+)\s*</div>'
+ NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>'
+ SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[\d .,]+)(?P<U>[\w^_]+)\s*</div>'
OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">'
SIZE_REPLACEMENTS = [(' ', '')]
- URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')]
+ URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')]
- FORCE_CHECK_TRAFFIC = True
+ CHECK_TRAFFIC = True
- FREE_URL_PATTERN = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>'
- FREE_FORM_PATTERN = r'<form action="download\.php" method="post">\s*<img src="captcha\.php" id="captcha" />(.*?)</form>'
+ FREE_URL_PATTERN = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>'
+ FREE_FORM_PATTERN = r'<form action="download\.php" method="post">\s*<img src="captcha\.php" id="captcha" />(.*?)</form>'
PREMIUM_FORM_PATTERN = r'<form action="/profi_down\.php" method="post">(.*?)</form>'
- FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]+)"[^>]*/>'
- MULTIDL_PATTERN = r'<p><font color=\'red\'>Z[^<]*PROFI.</font></p>'
- USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->'
+ FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]+)"[^>]*/>'
+ MULTIDL_PATTERN = r'<p><font color=\'red\'>Z[^<]*PROFI.</font></p>'
+ USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->'
def checkTrafficLeft(self):
diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py
index 21b6917d9..c3391e090 100644
--- a/module/plugins/hoster/DebridItaliaCom.py
+++ b/module/plugins/hoster/DebridItaliaCom.py
@@ -34,13 +34,13 @@ class DebridItaliaCom(MultiHoster):
self.link = self.html.strip()
else:
errmsg = re.search(r'ERROR:(.*)', self.html).group(1).strip()
-
+
self.html = self.load("http://debriditalia.com/linkgen2.php",
post={'xjxfun' : "convertiLink",
'xjxargs[]': "S<![CDATA[%s]]>" % self.pyfile.url})
self.link = re.search(r'<a href="(.+?)"', self.html).group(1)
-
+
if not self.link:
self.fail(errmsg)
diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py
index 5f88051a6..782d78ce1 100644
--- a/module/plugins/hoster/MediafireCom.py
+++ b/module/plugins/hoster/MediafireCom.py
@@ -54,7 +54,7 @@ def getInfo(urls):
class MediafireCom(SimpleHoster):
__name__ = "MediafireCom"
__type__ = "hoster"
- __version__ = "0.81"
+ __version__ = "0.82"
__pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download\.php)?\?)(\w{11}|\w{15})($|/)'
@@ -65,7 +65,7 @@ class MediafireCom(SimpleHoster):
NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>'
- INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<sha256>[^\']*)\'\)'
+ INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<H>[^\']*)\'\)'
OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>'
PASSWORD_PATTERN = r'<form name="form_password"'
diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py
index b3100b6d4..37732ade6 100644
--- a/module/plugins/hoster/MegaRapidCz.py
+++ b/module/plugins/hoster/MegaRapidCz.py
@@ -22,7 +22,7 @@ def getInfo(urls):
class MegaRapidCz(SimpleHoster):
__name__ = "MegaRapidCz"
__type__ = "hoster"
- __version__ = "0.54"
+ __version__ = "0.55"
__pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+'
@@ -38,7 +38,7 @@ class MegaRapidCz(SimpleHoster):
SIZE_PATTERN = r'<td class="i">Velikost:</td>\s*<td class="h"><strong>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong></td>'
OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán'
- FORCE_CHECK_TRAFFIC = True
+ CHECK_TRAFFIC = True
LINK_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>'
ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům'
diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py
index bc2382dc1..2be952efe 100644
--- a/module/plugins/hoster/RarefileNet.py
+++ b/module/plugins/hoster/RarefileNet.py
@@ -8,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class RarefileNet(XFSHoster):
__name__ = "RarefileNet"
__type__ = "hoster"
- __version__ = "0.08"
+ __version__ = "0.09"
__pattern__ = r'http://(?:www\.)?rarefile\.net/\w{12}'
@@ -19,7 +19,7 @@ class RarefileNet(XFSHoster):
HOSTER_DOMAIN = "rarefile.net"
- LINK_PATTERN = r'<a href="(.+?)">(?P=\1)</a>'
+ LINK_PATTERN = r'<a href="(.+?)">\1</a>'
getInfo = create_getInfo(RarefileNet)
diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py
index 235ad2434..a4e352956 100644
--- a/module/plugins/hoster/TusfilesNet.py
+++ b/module/plugins/hoster/TusfilesNet.py
@@ -23,8 +23,8 @@ class TusfilesNet(XFSHoster):
def setup(self):
- self.multiDL = False
- self.chunkLimit = -1
+ self.multiDL = False
+ self.chunkLimit = -1
self.resumeDownload = True
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 784ef8c85..ab114c9ec 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -155,7 +155,7 @@ def _isDirectLink(self, url, resumable=True):
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "0.77"
+ __version__ = "0.78"
__pattern__ = r'^unmatchable$'
@@ -214,9 +214,9 @@ class SimpleHoster(Hoster):
TEXT_ENCODING = False #: Set to True or encoding name if encoding value in http header is not correct
COOKIES = True #: or False or list of tuples [(domain, name, value)]
- FORCE_CHECK_TRAFFIC = False #: Set to True to force checking traffic left for premium account
- CHECK_DIRECT_LINK = None #: Set to True to check for direct link, set to None to do it only if self.account is True
- MULTI_HOSTER = False #: Set to True to leech other hoster link (according its multihoster hook if available)
+ CHECK_TRAFFIC = False #: Set to True to force checking traffic left for premium account
+ 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)
@classmethod
@@ -334,17 +334,13 @@ class SimpleHoster(Hoster):
if (self.MULTI_HOSTER
and (self.__pattern__ != self.core.pluginManager.hosterPlugins[self.__name__]['pattern']
or re.match(self.__pattern__, self.pyfile.url) is None)):
+ self.multihost = True
+ return
- self.logInfo("Multi hoster detected")
-
- if self.account:
- self.multihost = True
- return
- else:
- self.fail(_("Only registered or premium users can use url leech feature"))
-
- if self.CHECK_DIRECT_LINK is None:
+ if self.DIRECT_LINK is None:
self.directDL = bool(self.account)
+ else:
+ self.directDL = self.DIRECT_LINK
self.pyfile.url = replace_patterns(self.pyfile.url,
self.FILE_URL_REPLACEMENTS if hasattr(self, "FILE_URL_REPLACEMENTS") else self.URL_REPLACEMENTS) #@TODO: Remove FILE_URL_REPLACEMENTS check in 0.4.10
@@ -360,16 +356,20 @@ class SimpleHoster(Hoster):
def process(self, pyfile):
self.prepare()
- if self.multihost:
+ if self.directDL:
+ self.logDebug("Looking for direct download link...")
+ self.handleDirect()
+
+ if self.multihost and not self.link and not self.lastDownload:
self.logDebug("Looking for leeched download link...")
self.logDebug("File url: %s" % pyfile.url)
self.handleMulti()
- elif self.directDL:
- self.logDebug("Looking for direct download link...")
- self.handleDirect()
+ if not self.link and not self.lastDownload:
+ self.MULTI_HOSTER = False
+ self.retry(1, reason="Multi hoster fails")
- if not self.link:
+ if not self.link and not self.lastDownload:
self.preload()
if self.html is None:
@@ -390,7 +390,7 @@ class SimpleHoster(Hoster):
self.checkErrors()
- if self.premium and (not self.FORCE_CHECK_TRAFFIC or self.checkTrafficLeft()):
+ if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()):
self.logDebug("Handled as premium download")
self.handlePremium()
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 7038743c1..dd2dd2527 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -16,7 +16,7 @@ from module.utils import html_unescape
class XFSHoster(SimpleHoster):
__name__ = "XFSHoster"
__type__ = "hoster"
- __version__ = "0.30"
+ __version__ = "0.31"
__pattern__ = r'^unmatchable$'
@@ -142,6 +142,9 @@ class XFSHoster(SimpleHoster):
def handleMulti(self):
+ if not self.account:
+ self.fail(_("Only registered or premium users can use url leech feature"))
+
#only tested with easybytez.com
self.html = self.load("http://www.%s/" % self.HOSTER_DOMAIN)