From 3b7fcc7d34389b2a9b7f5ffc7411a7ae5411d28a Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Wed, 15 Aug 2012 21:37:20 +0200 Subject: 2shared - closed #656, 4shared - closed #651 (dl with free account only) --- module/plugins/hoster/FourSharedCom.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/FourSharedCom.py') 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 = '' + FILE_NAME_PATTERN = r'Download file now" + 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) -- cgit v1.2.3