summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/accounts/NoPremiumPl.py25
-rw-r--r--module/plugins/hooks/NoPremiumPl.py2
-rw-r--r--module/plugins/hoster/NoPremiumPl.py12
3 files changed, 8 insertions, 31 deletions
diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py
index df9e94a42..494b559c3 100644
--- a/module/plugins/accounts/NoPremiumPl.py
+++ b/module/plugins/accounts/NoPremiumPl.py
@@ -3,9 +3,7 @@
from datetime import datetime
from module.plugins.Account import Account
-from module.plugins.internal.SimpleHoster import parseHtmlForm
-import re
-from time import mktime, strptime
+from time import mktime
import module.lib.beaker.crypto as crypto
try:
@@ -13,6 +11,7 @@ try:
except ImportError:
from simplejson import loads
+
class NoPremiumPl(Account):
__name__ = "NoPremiumPl"
__version__ = "0.01"
@@ -37,38 +36,31 @@ class NoPremiumPl(Account):
_pwd = None
def loadAccountInfo(self, name, req):
-
self._req = req
-
try:
result = loads(self.runAuthQuery())
except:
- #todo: return or let it be thrown?
+ # todo: return or let it be thrown?
return
premium = False
valid_untill = -1
-
is_premium = "expire" in result.keys() and result["expire"] is not None
if is_premium:
-
premium = True
valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple())
-
traffic_left = result["balance"] * 1024
return ({
- "validuntil": valid_untill,
- "trafficleft": traffic_left,
- "premium": premium
- })
+ "validuntil": valid_untill,
+ "trafficleft": traffic_left,
+ "premium": premium
+ })
def login(self, user, data, req):
-
self._usr = user
self._pwd = crypto.sha1(crypto.md5(data["password"]).hexdigest()).hexdigest()
-
self._req = req
try:
@@ -78,12 +70,10 @@ class NoPremiumPl(Account):
if "errno" in response.keys():
self.wrongPassword()
-
data['usr'] = self._usr
data['pwd'] = self._pwd
def createAuthQuery(self):
-
query = self._api_query
query["username"] = self._usr
query["password"] = self._pwd
@@ -91,7 +81,6 @@ class NoPremiumPl(Account):
return query
def runAuthQuery(self):
-
data = self._req.load(self._api_url, post=self.createAuthQuery())
return data \ No newline at end of file
diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py
index ef36331eb..121e92f91 100644
--- a/module/plugins/hooks/NoPremiumPl.py
+++ b/module/plugins/hooks/NoPremiumPl.py
@@ -24,8 +24,8 @@ class NoPremiumPl(MultiHoster):
__author_mail__ = ("dev@nopremium.pl")
def getHoster(self):
-
hostings = loads(getURL("https://www.nopremium.pl/clipboard.php?json=3").strip())
+
return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"]
def getHosterCached(self):
diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py
index 7665e589f..bd5260a55 100644
--- a/module/plugins/hoster/NoPremiumPl.py
+++ b/module/plugins/hoster/NoPremiumPl.py
@@ -9,7 +9,6 @@ from module.plugins.internal.SimpleHoster import SimpleHoster
class NoPremiumPl(SimpleHoster):
-
__name__ = "NoPremiumPl"
__version__ = "0.01"
__type__ = "hoster"
@@ -30,42 +29,31 @@ class NoPremiumPl(SimpleHoster):
_pwd = False
def setup(self):
-
self.resumeDownload = True
self.multiDL = True
def get_username_password(self):
-
if not self.account:
-
self.fail("[NoPremium.pl] Zaloguj się we wtyczce NoPremium.pl lub ją wyłącz")
-
else:
-
self._usr = self.account.getAccountData(self.user).get('usr')
self._pwd = self.account.getAccountData(self.user).get('pwd')
def runFileQuery(self, url, mode=None):
-
query = self._api_query.copy()
-
query["username"] = self._usr
query["password"] = self._pwd
-
query["url"] = url
if mode == "fileinfo":
query['check'] = 2
query['loc'] = 1
-
self.logDebug(query)
return self.load(self._api_url, post=query)
def process(self, pyfile):
-
self.get_username_password()
-
try:
data = self.runFileQuery(pyfile.url, 'fileinfo')
except Exception as e: