From 4a077f1ab66b201eb6e819ca3a8d18d54cc54cbf Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Sep 2014 12:56:29 +0200 Subject: [TusfilesNet] Added support for Premium users https://github.com/pyload/pyload/pull/755 --- module/plugins/accounts/TusfilesNet.py | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 module/plugins/accounts/TusfilesNet.py (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py new file mode 100644 index 000000000..d7cdbaebb --- /dev/null +++ b/module/plugins/accounts/TusfilesNet.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +import re + +from time import mktime, strptime, gmtime + +from module.plugins.Account import Account +from module.plugins.internal.SimpleHoster import parseHtmlForm +from module.utils import parseFileSize + + +class TusfilesNet(Account): + __name__ = "TusfilesNet" + __type__ = "account" + __version__ = "0.01" + + __description__ = """ Tusfile.net account plugin """ + __author_name__ = "guidobelix" + __author_mail__ = "guidobelix@hotmail.it" + + VALID_UNTIL_PATTERN = r'([^<]+)' + TRAFFIC_LEFT_PATTERN = r'\n (?P[^<]+)' + + + def loadAccountInfo(self, user, req): + html = req.load("http://www.tusfiles.net/?op=my_account", decode=True) + + validuntil = None + trafficleft = None + premium = False + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1) + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%d %B %Y")) + except Exception, e: + self.logError(e) + + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = None + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + trafficleft = m.group(1) + if "Unlimited" in trafficleft: + trafficleft = -1 + else: + trafficleft = parseFileSize(trafficleft) * 1024 + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + + + def login(self, user, data, req): + html = req.load("http://www.tusfiles.net/login.html", decode=True) + action, inputs = parseHtmlForm('name="FL"', html) + inputs.update({'login': user, + 'password': data['password'], + 'redirect': "http://www.tusfiles.net/"}) + + html = req.load("http://www.tusfiles.net/", post=inputs, decode=True) + + if 'Incorrect Login or Password' in html or '>Error<' in html: + self.wrongPassword() -- cgit v1.2.3 From 7dee5afc46e69b38e1ad660b46db8427b64e961f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 13:15:05 +0200 Subject: [TusfilesNet] Now XFSPAccount plugin based --- module/plugins/accounts/TusfilesNet.py | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index d7cdbaebb..3de98564c 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -4,26 +4,28 @@ import re from time import mktime, strptime, gmtime -from module.plugins.Account import Account -from module.plugins.internal.SimpleHoster import parseHtmlForm +from module.plugins.internal.XFSPAccount import XFSPAccount from module.utils import parseFileSize -class TusfilesNet(Account): +class TusfilesNet(XFSPAccount): __name__ = "TusfilesNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """ Tusfile.net account plugin """ __author_name__ = "guidobelix" __author_mail__ = "guidobelix@hotmail.it" + + HOSTER_URL = "http://www.tusfiles.net/" + VALID_UNTIL_PATTERN = r'([^<]+)' TRAFFIC_LEFT_PATTERN = r'\n (?P[^<]+)' def loadAccountInfo(self, user, req): - html = req.load("http://www.tusfiles.net/?op=my_account", decode=True) + html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) validuntil = None trafficleft = None @@ -54,16 +56,3 @@ class TusfilesNet(Account): trafficleft = parseFileSize(trafficleft) * 1024 return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - - - def login(self, user, data, req): - html = req.load("http://www.tusfiles.net/login.html", decode=True) - action, inputs = parseHtmlForm('name="FL"', html) - inputs.update({'login': user, - 'password': data['password'], - 'redirect': "http://www.tusfiles.net/"}) - - html = req.load("http://www.tusfiles.net/", post=inputs, decode=True) - - if 'Incorrect Login or Password' in html or '>Error<' in html: - self.wrongPassword() -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/accounts/TusfilesNet.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index 3de98564c..eb244e7ea 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -14,8 +14,7 @@ class TusfilesNet(XFSPAccount): __version__ = "0.02" __description__ = """ Tusfile.net account plugin """ - __author_name__ = "guidobelix" - __author_mail__ = "guidobelix@hotmail.it" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] HOSTER_URL = "http://www.tusfiles.net/" -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/accounts/TusfilesNet.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index eb244e7ea..704f70742 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -14,6 +14,7 @@ class TusfilesNet(XFSPAccount): __version__ = "0.02" __description__ = """ Tusfile.net account plugin """ + __license__ = "GPLv3" __authors__ = [("guidobelix", "guidobelix@hotmail.it")] -- cgit v1.2.3 From c5d1a4fd8943877c6d2eb3843e0de725dba5191e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:09:53 +0200 Subject: Pattern update 2 --- module/plugins/accounts/TusfilesNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index 704f70742..a1b3613b2 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -21,7 +21,7 @@ class TusfilesNet(XFSPAccount): HOSTER_URL = "http://www.tusfiles.net/" VALID_UNTIL_PATTERN = r'([^<]+)' - TRAFFIC_LEFT_PATTERN = r'\n (?P[^<]+)' + TRAFFIC_LEFT_PATTERN = r'\n (?P[^<]+)' def loadAccountInfo(self, user, req): -- cgit v1.2.3 From 90c4bf19a6b03e28c9be69a20ce6330391dcb839 Mon Sep 17 00:00:00 2001 From: guidobelix Date: Wed, 15 Oct 2014 20:28:28 +0200 Subject: Sinplified after the improvements to XFSPAccount modified: module/plugins/accounts/TusfilesNet.py --- module/plugins/accounts/TusfilesNet.py | 36 +--------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index a1b3613b2..775aab9c0 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -11,7 +11,7 @@ from module.utils import parseFileSize class TusfilesNet(XFSPAccount): __name__ = "TusfilesNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """ Tusfile.net account plugin """ __license__ = "GPLv3" @@ -22,37 +22,3 @@ class TusfilesNet(XFSPAccount): VALID_UNTIL_PATTERN = r'([^<]+)' TRAFFIC_LEFT_PATTERN = r'\n (?P[^<]+)' - - - def loadAccountInfo(self, user, req): - html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) - - validuntil = None - trafficleft = None - premium = False - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - expiredate = m.group(1) - self.logDebug("Expire date: " + expiredate) - - try: - validuntil = mktime(strptime(expiredate, "%d %B %Y")) - except Exception, e: - self.logError(e) - - if validuntil > mktime(gmtime()): - premium = True - else: - premium = False - validuntil = None - - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = m.group(1) - if "Unlimited" in trafficleft: - trafficleft = -1 - else: - trafficleft = parseFileSize(trafficleft) * 1024 - - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} -- cgit v1.2.3 From 6a6373e9b63ce7943f1a6592a641e3d8b3f31e09 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 17 Oct 2014 21:10:40 +0200 Subject: Fix TRAFFIC_LEFT_PATTERN in RapidfileshareNet and TusfilesNet accounts --- module/plugins/accounts/TusfilesNet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index 775aab9c0..ab5b57834 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -11,7 +11,7 @@ from module.utils import parseFileSize class TusfilesNet(XFSPAccount): __name__ = "TusfilesNet" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """ Tusfile.net account plugin """ __license__ = "GPLv3" @@ -21,4 +21,4 @@ class TusfilesNet(XFSPAccount): HOSTER_URL = "http://www.tusfiles.net/" VALID_UNTIL_PATTERN = r'([^<]+)' - TRAFFIC_LEFT_PATTERN = r'\n (?P[^<]+)' + TRAFFIC_LEFT_PATTERN = r'\n (?P[\d.,]+)\s*(?P[\w^_]+)\s*' -- cgit v1.2.3 From 7b3009db0d90cbcd5a754c69399b5e4c6abe180c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 18 Oct 2014 13:52:42 +0200 Subject: Update accounts to use HOSTER_NAME instead HOSTER_URL --- module/plugins/accounts/TusfilesNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index ab5b57834..dcb9fa104 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -18,7 +18,7 @@ class TusfilesNet(XFSPAccount): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_URL = "http://www.tusfiles.net/" + HOSTER_NAME = "tusfiles.net" VALID_UNTIL_PATTERN = r'([^<]+)' TRAFFIC_LEFT_PATTERN = r'\n (?P[\d.,]+)\s*(?P[\w^_]+)\s*' -- cgit v1.2.3 From e41f3d7f9bac5c5923d5e3e4ae4b373f6c90dc16 Mon Sep 17 00:00:00 2001 From: guidobelix Date: Wed, 22 Oct 2014 21:41:11 +0200 Subject: Broken TRAFFIC_LEFT_PATTERN in RapidfileshareNet and TusfilesNet account --- module/plugins/accounts/TusfilesNet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index dcb9fa104..65f35a8e2 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -11,7 +11,7 @@ from module.utils import parseFileSize class TusfilesNet(XFSPAccount): __name__ = "TusfilesNet" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """ Tusfile.net account plugin """ __license__ = "GPLv3" @@ -21,4 +21,4 @@ class TusfilesNet(XFSPAccount): HOSTER_NAME = "tusfiles.net" VALID_UNTIL_PATTERN = r'([^<]+)' - TRAFFIC_LEFT_PATTERN = r'\n (?P[\d.,]+)\s*(?P[\w^_]+)\s*' + TRAFFIC_LEFT_PATTERN = r'\n (?P[\d.,]+)' -- cgit v1.2.3 From 29de13dc5098cc9214f3f8f111da140a22e3e2ff Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 01:15:58 +0200 Subject: Use parseTraffic instead parseFileSize in accounts --- module/plugins/accounts/TusfilesNet.py | 1 - 1 file changed, 1 deletion(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index 65f35a8e2..d52169fae 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -5,7 +5,6 @@ import re from time import mktime, strptime, gmtime from module.plugins.internal.XFSPAccount import XFSPAccount -from module.utils import parseFileSize class TusfilesNet(XFSPAccount): -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/accounts/TusfilesNet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index d52169fae..8f41930a5 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -8,13 +8,13 @@ from module.plugins.internal.XFSPAccount import XFSPAccount class TusfilesNet(XFSPAccount): - __name__ = "TusfilesNet" - __type__ = "account" + __name__ = "TusfilesNet" + __type__ = "account" __version__ = "0.05" __description__ = """ Tusfile.net account plugin """ - __license__ = "GPLv3" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] HOSTER_NAME = "tusfiles.net" -- cgit v1.2.3 From 772e47ef806d18fd209e910be0535bce7c07dc7b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 2 Nov 2014 22:47:07 +0100 Subject: Update all other plugins --- module/plugins/accounts/TusfilesNet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/accounts/TusfilesNet.py') diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index 8f41930a5..279dfd00a 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -4,20 +4,20 @@ import re from time import mktime, strptime, gmtime -from module.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class TusfilesNet(XFSPAccount): +class TusfilesNet(XFSAccount): __name__ = "TusfilesNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __description__ = """ Tusfile.net account plugin """ __license__ = "GPLv3" __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_NAME = "tusfiles.net" + HOSTER_DOMAIN = "tusfiles.net" VALID_UNTIL_PATTERN = r'([^<]+)' TRAFFIC_LEFT_PATTERN = r'\n (?P[\d.,]+)' -- cgit v1.2.3