From 24bf61533574a5ff81559d60627a7a9b2a926696 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 18:48:57 +0100 Subject: [NowVideoSx] Fixup --- module/plugins/accounts/NowVideoAt.py | 56 ----------------------------------- module/plugins/accounts/NowVideoSx.py | 56 +++++++++++++++++++++++++++++++++++ module/plugins/hoster/NowVideoSx.py | 6 ++-- 3 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 module/plugins/accounts/NowVideoAt.py create mode 100644 module/plugins/accounts/NowVideoSx.py diff --git a/module/plugins/accounts/NowVideoAt.py b/module/plugins/accounts/NowVideoAt.py deleted file mode 100644 index 234984b6b..000000000 --- a/module/plugins/accounts/NowVideoAt.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import gmtime, mktime, strptime - -from module.plugins.Account import Account - - -class NowVideoAt(Account): - __name__ = "NowVideoAt" - __type__ = "account" - __version__ = "0.01" - - __description__ = """NowVideo.at account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<' - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = -1 - premium = None - - html = req.load("http://www.nowvideo.at/premium.php") - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - expiredate = m.group(1).strip() - self.logDebug("Expire date: " + expiredate) - - try: - validuntil = mktime(strptime(expiredate, "%Y-%b-%d")) - - except Exception, e: - self.logError(e) - - else: - if validuntil > mktime(gmtime()): - premium = True - else: - premium = False - validuntil = -1 - - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - - - def login(self, user, data, req): - html = req.load("http://www.nowvideo.at/login.php", - post={'user': user, 'pass': data['password']}) - - if ">Invalid login details" is html: - self.wrongPassword() diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py new file mode 100644 index 000000000..e2dcaba12 --- /dev/null +++ b/module/plugins/accounts/NowVideoSx.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +import re + +from time import gmtime, mktime, strptime + +from module.plugins.Account import Account + + +class NowVideoSx(Account): + __name__ = "NowVideoSx" + __type__ = "account" + __version__ = "0.02" + + __description__ = """NowVideo.at account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<' + + + def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = -1 + premium = None + + html = req.load("http://www.nowvideo.sx/premium.php") + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%Y-%b-%d")) + + except Exception, e: + self.logError(e) + + else: + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = -1 + + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + + + def login(self, user, data, req): + html = req.load("http://www.nowvideo.sx/login.php", + post={'user': user, 'pass': data['password']}) + + if ">Invalid login details" is html: + self.wrongPassword() diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index b59bd79da..d0777ca4b 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NowVideoSx(SimpleHoster): __name__ = "NowVideoSx" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|sx)/(video|mobile/#/videos)/(?P\w+)' @@ -17,7 +17,7 @@ class NowVideoSx(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.nowvideo.at/video/\g')] + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.nowvideo.sx/video/\g')] NAME_PATTERN = r'

(?P.+?)<' OFFLINE_PATTERN = r'>This file no longer exists' @@ -32,7 +32,7 @@ class NowVideoSx(SimpleHoster): def handleFree(self): - self.html = self.load("http://www.nowvideo.at/mobile/video.php", get={'id': self.info['pattern']['ID']}) + self.html = self.load("http://www.nowvideo.sx/mobile/video.php", get={'id': self.info['pattern']['ID']}) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: -- cgit v1.2.3