summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/accounts/FourSharedCom.py48
-rw-r--r--module/plugins/hoster/DdlstorageCom.py2
-rw-r--r--module/plugins/hoster/FourSharedCom.py24
-rw-r--r--module/plugins/hoster/TwoSharedCom.py7
4 files changed, 72 insertions, 9 deletions
diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py
new file mode 100644
index 000000000..bd3820277
--- /dev/null
+++ b/module/plugins/accounts/FourSharedCom.py
@@ -0,0 +1,48 @@
+# -*- 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
+"""
+
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+class FourSharedCom(Account):
+ __name__ = "FourSharedCom"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """FourSharedCom account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def loadAccountInfo(self, user, req):
+ #fixme
+ return ({"validuntil": -1, "trafficleft": -1, "premium": False})
+
+ def login(self, user, data, req):
+ req.cj.setCookie("www.4shared.com", "4langcookie", "en")
+ response = req.load('http://www.4shared.com/login',
+ post = {"login": user,
+ "password": data['password'],
+ "remember": "false",
+ "doNotRedirect": "true"})
+ self.logDebug(response)
+ response = json_loads(response)
+
+ if not "ok" in response or response['ok'] != True:
+ if "rejectReason" in response and response['rejectReason'] != True:
+ self.logError(response['rejectReason'])
+ self.wrongPassword() \ No newline at end of file
diff --git a/module/plugins/hoster/DdlstorageCom.py b/module/plugins/hoster/DdlstorageCom.py
index a6c68c384..1390c31cc 100644
--- a/module/plugins/hoster/DdlstorageCom.py
+++ b/module/plugins/hoster/DdlstorageCom.py
@@ -5,7 +5,7 @@ class DdlstorageCom(XFileSharingPro):
__name__ = "DdlstorageCom"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*?ddlstorage.com/\w{12}"
- __version__ = "0.03"
+ __version__ = "0.04"
__description__ = """DDLStorage.com hoster plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py
index 2b27eed28..551706283 100644
--- a/module/plugins/hoster/FourSharedCom.py
+++ b/module/plugins/hoster/FourSharedCom.py
@@ -7,33 +7,45 @@ import re
class FourSharedCom(SimpleHoster):
__name__ = "FourSharedCom"
__type__ = "hoster"
- __pattern__ = r"http://[\w\.]*?4shared(-china)?\.com/(account/)?(download|get|file|document|photo|video|audio)/.+?/.*"
- __version__ = "0.25"
+ __pattern__ = r"http://[\w\.]*?4shared(-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|office)/.+?/.*"
+ __version__ = "0.28"
__description__ = """4Shared Download Hoster"""
__author_name__ = ("jeix", "zoidberg")
__author_mail__ = ("jeix@hasnomail.de", "zoidberg@mujmail.cz")
- FILE_NAME_PATTERN = '<meta name="title" content="(?P<N>[^"]+)" />'
+ FILE_NAME_PATTERN = r'<meta name="title" content="(?P<N>.+?)"'
FILE_SIZE_PATTERN = '<span title="Size: (?P<S>[0-9,.]+) (?P<U>[kKMG])i?B">'
FILE_OFFLINE_PATTERN = 'The file link that you requested is not valid\.|This file was deleted.'
FILE_NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))]
+ FILE_SIZE_REPLACEMENTS = [(",", "")]
- DOWNLOAD_BUTTON_PATTERN = '<a href="([^"]+)"\s*class="dbtn'
- DOWNLOAD_URL_PATTERN = r"<a class=\"linkShowD3\" href='([^']+)'>Download file now</a>"
+ DOWNLOAD_BUTTON_PATTERN = 'id="btnLink" href="(.*?)"'
+ FID_PATTERN = 'name="d3fid" value="(.*?)"'
+ DOWNLOAD_URL_PATTERN = r'name="d3link" value="(.*?)"'
def handleFree(self):
+ if not self.account:
+ self.fail("User not logged in")
+
found = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html)
if found:
link = found.group(1)
else:
link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', self.pyfile.url)
-
+
self.html = self.load(link)
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
if not found: self.parseError('Download link')
link = found.group(1)
+ try:
+ found = re.search(self.FID_PATTERN, self.html)
+ response = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % found.group(1))
+ self.logDebug(response)
+ except:
+ pass
+
self.setWait(20)
self.wait()
self.download(link)
diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py
index 89c4b7781..8401e0cb0 100644
--- a/module/plugins/hoster/TwoSharedCom.py
+++ b/module/plugins/hoster/TwoSharedCom.py
@@ -8,15 +8,18 @@ class TwoSharedCom(SimpleHoster):
__name__ = "TwoSharedCom"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?2shared.com/(account/)?(download|get|file|document|photo|video|audio)/.*"
- __version__ = "0.10"
+ __version__ = "0.11"
__description__ = """2Shared Download Hoster"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- FILE_NAME_PATTERN = r'<meta name="Description" content="(?P<N>.*) download free at 2shared'
+ FILE_NAME_PATTERN = r'<h1>(?P<N>.*)</h1>'
FILE_SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[0-9,.]+) (?P<U>[kKMG])i?B'
FILE_OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted\.'
DOWNLOAD_URL_PATTERN = r"window.location ='([^']+)';"
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
def handleFree(self):
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)