summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/FourSharedCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-09-07 23:40:50 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-09-14 10:58:42 +0200
commit887ad58e4c6c20b992311bbdf931bcd18e73d384 (patch)
treef31beb241bacca0bfea4c1acc4e9ace813755cef /module/plugins/hoster/FourSharedCom.py
parent[AccountManager] Fixed #733 (diff)
parent[File4safe] distributing LINK_PATTERN (diff)
downloadpyload-887ad58e4c6c20b992311bbdf931bcd18e73d384.tar.xz
Merge branch 'stable' into 0.4.10
Conflicts: module/plugins/Account.py module/plugins/AccountManager.py module/plugins/Hook.py module/plugins/OCR.py module/plugins/Plugin.py module/plugins/PluginManager.py module/plugins/ReCaptcha.py module/plugins/accounts/Ftp.py module/plugins/accounts/Http.py module/plugins/internal/MultiHoster.py module/plugins/ocr/GigasizeCom.py module/plugins/ocr/LinksaveIn.py module/plugins/ocr/NetloadIn.py module/plugins/ocr/ShareonlineBiz.py
Diffstat (limited to 'module/plugins/hoster/FourSharedCom.py')
-rw-r--r--module/plugins/hoster/FourSharedCom.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py
index 9c7752fe1..2668a22d3 100644
--- a/module/plugins/hoster/FourSharedCom.py
+++ b/module/plugins/hoster/FourSharedCom.py
@@ -8,42 +8,46 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class FourSharedCom(SimpleHoster):
__name__ = "FourSharedCom"
__type__ = "hoster"
- __pattern__ = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+?/.*'
__version__ = "0.29"
+
+ __pattern__ = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+?/.*'
+
__description__ = """4Shared.com hoster plugin"""
__author_name__ = ("jeix", "zoidberg")
__author_mail__ = ("jeix@hasnomail.de", "zoidberg@mujmail.cz")
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_SIZE_PATTERN = r'<span title="Size: (?P<S>[0-9,.]+) (?P<U>[kKMG])i?B">'
+ OFFLINE_PATTERN = r'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 = 'id="btnLink" href="(.*?)"'
- FID_PATTERN = 'name="d3fid" value="(.*?)"'
DOWNLOAD_URL_PATTERN = r'name="d3link" value="(.*?)"'
+ DOWNLOAD_BUTTON_PATTERN = r'id="btnLink" href="(.*?)"'
+ FID_PATTERN = r'name="d3fid" 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)
+ m = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html)
+ if m:
+ link = m.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:
+ m = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
+ if m is None:
self.parseError('Download link')
- link = found.group(1)
+ link = m.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))
+ m = re.search(self.FID_PATTERN, self.html)
+ response = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1))
self.logDebug(response)
except:
pass