summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2014-05-03 22:24:38 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2014-05-03 22:24:58 +0200
commitbd4ead18e025c6aff3d37b74cacae2731e738aa2 (patch)
tree3b1bf1dc667c226ae20f4186ebbd26863efa0784
parent1Fichier: premium support (diff)
downloadpyload-bd4ead18e025c6aff3d37b74cacae2731e738aa2.tar.xz
File4safe premium
+ XFSPAccount improved Resolves #431
-rw-r--r--module/plugins/accounts/File4safeCom.py17
-rw-r--r--module/plugins/hooks/XFileSharingPro.py4
-rw-r--r--module/plugins/hoster/File4safeCom.py36
-rw-r--r--module/plugins/internal/XFSPAccount.py10
4 files changed, 61 insertions, 6 deletions
diff --git a/module/plugins/accounts/File4safeCom.py b/module/plugins/accounts/File4safeCom.py
new file mode 100644
index 000000000..6a11493d2
--- /dev/null
+++ b/module/plugins/accounts/File4safeCom.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.XFSPAccount import XFSPAccount
+
+
+class File4safeCom(XFSPAccount):
+ __name__ = "File4safeCom"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """File4safe.com account plugin"""
+ __author_name__ = "stickell"
+ __author_mail__ = "l.stickell@yahoo.it"
+
+ MAIN_PAGE = "http://file4safe.com/"
+
+ LOGIN_FAIL_PATTERN = r'input_login'
+ PREMIUM_PATTERN = r'Extend Premium'
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py
index 25a1c6a7f..19ecc08b6 100644
--- a/module/plugins/hooks/XFileSharingPro.py
+++ b/module/plugins/hooks/XFileSharingPro.py
@@ -7,7 +7,7 @@ from module.plugins.Hook import Hook
class XFileSharingPro(Hook):
__name__ = "XFileSharingPro"
- __version__ = "0.10"
+ __version__ = "0.11"
__type__ = "hook"
__config__ = [("activated", "bool", "Activated", True),
("loadDefault", "bool", "Include default (built-in) hoster list", True),
@@ -41,7 +41,7 @@ class XFileSharingPro(Hook):
"multishare.org", "omegave.org", "toucansharing.org", "uflinq.org", "banicrazy.info", "flowhot.info",
"upbrasil.info", "shareyourfilez.biz", "bzlink.us", "cloudcache.cc", "fileserver.cc", "farshare.to",
"filemaze.ws", "filehost.ws", "filestock.ru", "moidisk.ru", "4up.im", "100shared.com", "sharesix.com",
- "thefile.me", "filenuke.com", "sharerepo.com", "mightyupload.com", "file4safe.com",
+ "thefile.me", "filenuke.com", "sharerepo.com", "mightyupload.com",
#WRONG FILE NAME:
"sendmyway.com", "upchi.co.il",
#NOT WORKING:
diff --git a/module/plugins/hoster/File4safeCom.py b/module/plugins/hoster/File4safeCom.py
new file mode 100644
index 000000000..9e06972e2
--- /dev/null
+++ b/module/plugins/hoster/File4safeCom.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+import re
+from pycurl import FOLLOWLOCATION
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class File4safeCom(XFileSharingPro):
+ __name__ = "File4safeCom"
+ __type__ = "hoster"
+ __pattern__ = r'https?://(?:www\.)?file4safe\.com/\w+'
+ __version__ = "0.01"
+ __description__ = """File4safe.com hoster plugin"""
+ __author_name__ = "stickell"
+ __author_mail__ = "l.stickell@yahoo.it"
+
+ HOSTER_NAME = "file4safe.com"
+
+ def handlePremium(self):
+ self.req.http.lastURL = self.pyfile.url
+
+ self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.load(self.pyfile.url, post=self.getPostParameters(), decode=True)
+ self.header = self.req.http.header
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+
+ found = re.search(r"Location\s*:\s*(.*)", self.header, re.I)
+ if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)):
+ location = found.group(1).strip()
+ self.startDownload(location)
+ else:
+ self.parseError("Unable to detect premium download link")
+
+
+getInfo = create_getInfo(File4safeCom)
diff --git a/module/plugins/internal/XFSPAccount.py b/module/plugins/internal/XFSPAccount.py
index 787e7fa9e..76aff54f0 100644
--- a/module/plugins/internal/XFSPAccount.py
+++ b/module/plugins/internal/XFSPAccount.py
@@ -26,7 +26,7 @@ from module.utils import parseFileSize
class XFSPAccount(Account):
__name__ = "XFSPAccount"
- __version__ = "0.05"
+ __version__ = "0.06"
__type__ = "account"
__description__ = """XFileSharingPro base account plugin"""
__author_name__ = "zoidberg"
@@ -36,12 +36,14 @@ class XFSPAccount(Account):
VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:</TD><TD><b>([^<]+)</b>'
TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><b>([^<]+)</b>'
+ LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|>Error<'
+ PREMIUM_PATTERN = r'>Renew premium<'
def loadAccountInfo(self, user, req):
html = req.load(self.MAIN_PAGE + "?op=my_account", decode=True)
validuntil = trafficleft = None
- premium = True if '>Renew premium<' in html else False
+ premium = True if re.search(self.PREMIUM_PATTERN, html) else False
found = re.search(self.VALID_UNTIL_PATTERN, html)
if found:
@@ -61,7 +63,7 @@ class XFSPAccount(Account):
else:
trafficleft = parseFileSize(trafficleft) / 1024
- return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium})
+ return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}
def login(self, user, data, req):
html = req.load('%slogin.html' % self.MAIN_PAGE, decode=True)
@@ -76,5 +78,5 @@ class XFSPAccount(Account):
html = req.load(self.MAIN_PAGE, post=inputs, decode=True)
- if 'Incorrect Login or Password' in html or '>Error<' in html:
+ if re.search(self.LOGIN_FAIL_PATTERN, html):
self.wrongPassword()