From a0073934475c4955d4c6a7b6c805ca37c0b6d30b Mon Sep 17 00:00:00 2001 From: Guidobelix Date: Sun, 14 Sep 2014 16:34:01 +0200 Subject: Fixed EasybytezCom to work properly for registered (free) users Expire date is meaningful only for Premium users. For registered (free) users expire date is set to -1 (free accounts never expire). --- module/plugins/accounts/EasybytezCom.py | 36 +++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index 3b8517686..105c365b5 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -11,11 +11,11 @@ from module.utils import parseFileSize class EasybytezCom(Account): __name__ = "EasybytezCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """EasyBytez.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __author_name__ = ("zoidberg", "guidobelix") + __author_mail__ = ("zoidberg@mujmail.cz", "guidobelix@hotmail.it") VALID_UNTIL_PATTERN = r'Premium account expire:([^<]+)' TRAFFIC_LEFT_PATTERN = r'Traffic available today:(?P[^<]+)' @@ -24,30 +24,36 @@ class EasybytezCom(Account): def loadAccountInfo(self, user, req): html = req.load("http://www.easybytez.com/?op=my_account", decode=True) - validuntil = trafficleft = None + validuntil = -1 + trafficleft = None premium = False m = re.search(self.VALID_UNTIL_PATTERN, html) if m: try: - self.logDebug("Expire date: " + m.group(1)) - validuntil = mktime(strptime(m.group(1), "%d %B %Y")) + expiredate = m.group(1) + self.logDebug("Expire date: " + expiredate) + validuntil = mktime(strptime(expiredate, "%d %B %Y")) except Exception, e: self.logError(e) - if validuntil > mktime(gmtime()): - premium = True - trafficleft = -1 - else: - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = m.group(1) - if "Unlimited" in trafficleft: + else: + if validuntil > mktime(gmtime()): + premium = True trafficleft = -1 else: - trafficleft = parseFileSize(trafficleft) / 1024 + premium = False + + 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.easybytez.com/login.html', decode=True) action, inputs = parseHtmlForm('name="FL"', html) -- cgit v1.2.3 From 03374192ff2a74fea3c7a2201c3ef9ef929e3a39 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 14 Sep 2014 16:50:20 +0200 Subject: [BasePlugin] Little code cosmetics --- module/plugins/hoster/BasePlugin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 54d789054..573288ade 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -from re import match, search +import re + from urllib import unquote from urlparse import urlparse @@ -25,10 +26,11 @@ class BasePlugin(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): """main function""" - #debug part, for api exerciser + #: debug part, for api exerciser if pyfile.url.startswith("DEBUG_API"): self.multiDL = False return @@ -74,6 +76,7 @@ class BasePlugin(Hoster): else: self.fail("No Plugin matched and not a downloadable url.") + def downloadFile(self, pyfile): url = pyfile.url @@ -86,7 +89,7 @@ class BasePlugin(Hoster): if 'location' in header: self.logDebug("Location: " + header['location']) - base = match(r'https?://[^/]+', url).group(0) + base = re.match(r'https?://[^/]+', url).group(0) if header['location'].startswith("http"): url = header['location'] elif header['location'].startswith("/"): @@ -100,7 +103,7 @@ class BasePlugin(Hoster): if 'content-disposition' in header: self.logDebug("Content-Disposition: " + header['content-disposition']) - m = search("filename(?P=|\*=(?P.+)'')(?P.*)", header['content-disposition']) + m = re.search("filename(?P=|\*=(?P.+)'')(?P.*)", header['content-disposition']) if m: disp = m.groupdict() self.logDebug(disp) -- cgit v1.2.3 From df2dcf1ccdbcc5197a224df9946595df907dc749 Mon Sep 17 00:00:00 2001 From: igel-kun Date: Mon, 15 Sep 2014 23:10:37 +0200 Subject: [XFilesharingPro] Embedded urls support --- module/plugins/hooks/XFileSharingPro.py | 7 +++++-- module/plugins/hoster/XFileSharingPro.py | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index eb0376921..e19b40e22 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __config__ = [("activated", "bool", "Activated", True), ("loadDefault", "bool", "Include default (built-in) hoster list", True), @@ -23,6 +23,7 @@ class XFileSharingPro(Hook): def coreReady(self): self.loadPattern() + def loadPattern(self): hosterList = self.getConfigSet('includeList') excludeList = self.getConfigSet('excludeList') @@ -60,7 +61,7 @@ class XFileSharingPro(Hook): self.unload() return - regexp = r"http://(?:[^/]*\.)?(%s)/\w{12}" % ("|".join(sorted(hosterList)).replace('.', '\.')) + regexp = r"http://(?:[^/]*\.)?(%s)/(?:embed-)?\w{12}" % ("|".join(sorted(hosterList)).replace('.', '\.')) #self.logDebug(regexp) dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] @@ -68,10 +69,12 @@ class XFileSharingPro(Hook): dict['re'] = re.compile(regexp) self.logDebug("Pattern loaded - handling %d hosters" % len(hosterList)) + def getConfigSet(self, option): s = self.getConfig(option).lower().replace('|', ',').replace(';', ',') return set([x.strip() for x in s.split(',')]) + def unload(self): dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] dict['pattern'] = r'^unmatchable$' diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 25492fb49..d7e24e0b0 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -21,7 +21,7 @@ class XFileSharingPro(SimpleHoster): """ __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __pattern__ = r'^unmatchable$' @@ -29,6 +29,8 @@ class XFileSharingPro(SimpleHoster): __author_name__ = ("zoidberg", "stickell") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + + FILE_URL_REPLACEMENTS = [(r'/embed-(\w{12}).*', r'/\1')] #: support embedded files FILE_INFO_PATTERN = r'Filename:(?P[^<]+)\s*.*?\((?P[^<]+)\)' FILE_NAME_PATTERN = r'[\d\.\,]+) ?(?P\w+)?\)' @@ -55,6 +57,7 @@ class XFileSharingPro(SimpleHoster): self.chunkLimit = 1 + def process(self, pyfile): self.prepare() @@ -88,6 +91,7 @@ class XFileSharingPro(SimpleHoster): else: self.handleFree() + def prepare(self): """ Initialize important variables """ if not hasattr(self, "HOSTER_NAME"): @@ -98,6 +102,7 @@ class XFileSharingPro(SimpleHoster): self.captcha = self.errmsg = None self.passwords = self.getPassword().splitlines() + def getDirectDownloadLink(self): """ Get download link for premium users with direct download enabled """ self.req.http.lastURL = self.pyfile.url @@ -114,11 +119,13 @@ class XFileSharingPro(SimpleHoster): return location + def handleFree(self): url = self.getDownloadLink() self.logDebug("Download URL: %s" % url) self.startDownload(url) + def getDownloadLink(self): for i in xrange(5): self.logDebug("Getting download link: #%d" % i) @@ -145,6 +152,7 @@ class XFileSharingPro(SimpleHoster): return m.group(1) + def handlePremium(self): self.html = self.load(self.pyfile.url, post=self.getPostParameters()) m = re.search(self.LINK_PATTERN, self.html) @@ -152,6 +160,7 @@ class XFileSharingPro(SimpleHoster): self.parseError('DIRECT LINK') self.startDownload(m.group(1)) + def handleOverriden(self): #only tested with easybytez.com self.html = self.load("http://www.%s/" % self.HOSTER_NAME) @@ -189,6 +198,7 @@ class XFileSharingPro(SimpleHoster): else: self.retry() + def startDownload(self, link): link = link.strip() if self.captcha: @@ -196,6 +206,7 @@ class XFileSharingPro(SimpleHoster): self.logDebug('DIRECT LINK: %s' % link) self.download(link, disposition=True) + def checkErrors(self): m = re.search(self.ERROR_PATTERN, self.html) if m: @@ -227,6 +238,7 @@ class XFileSharingPro(SimpleHoster): return self.errmsg + def getPostParameters(self): for _ in xrange(3): if not self.errmsg: @@ -288,6 +300,7 @@ class XFileSharingPro(SimpleHoster): else: self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN')) + def handleCaptcha(self, inputs): m = re.search(self.RECAPTCHA_URL_PATTERN, self.html) if m: -- cgit v1.2.3 From 8d2ce2b8c169b801c9e98d96cb2c2e6aa1c25f19 Mon Sep 17 00:00:00 2001 From: Guidobelix Date: Tue, 16 Sep 2014 17:02:29 +0200 Subject: Update EasybytezCom --- module/plugins/accounts/EasybytezCom.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index 105c365b5..564549521 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -11,7 +11,7 @@ from module.utils import parseFileSize class EasybytezCom(Account): __name__ = "EasybytezCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __description__ = """EasyBytez.com account plugin""" __author_name__ = ("zoidberg", "guidobelix") @@ -24,24 +24,26 @@ class EasybytezCom(Account): def loadAccountInfo(self, user, req): html = req.load("http://www.easybytez.com/?op=my_account", decode=True) - validuntil = -1 + 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: - expiredate = m.group(1) - self.logDebug("Expire date: " + expiredate) validuntil = mktime(strptime(expiredate, "%d %B %Y")) except Exception, e: self.logError(e) + + if validuntil > mktime(gmtime()): + premium = True + trafficleft = -1 else: - if validuntil > mktime(gmtime()): - premium = True - trafficleft = -1 - else: - premium = False + premium = False + validuntil = -1 m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: -- cgit v1.2.3 From 7257e2ec613a1dc8dee249d68b81a0b61e2d281c Mon Sep 17 00:00:00 2001 From: stickell Date: Wed, 17 Sep 2014 18:26:23 +0200 Subject: [PremiumTo] fixed issue with get parameter on download --- module/plugins/hoster/PremiumTo.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index 3ab7e34ac..92bec9295 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -11,7 +11,7 @@ from module.utils import fs_encode class PremiumTo(Hoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?premium.to/.*' __description__ = """Premium.to hoster plugin""" __author_name__ = ("RaNaN", "zoidberg", "stickell") @@ -34,8 +34,7 @@ class PremiumTo(Hoster): self.req.setOption("timeout", 120) self.download( - "http://premium.to/api/getfile.php", - get={"username": self.account.username, "password": self.account.password, "link": quote(pyfile.url, "")}, + "http://premium.to/api/getfile.php?username=%s&password=%s&link=%s" % (self.account.username, self.account.password, quote(pyfile.url, "")), disposition=True) check = self.checkDownload({"nopremium": "No premium account available"}) -- cgit v1.2.3 From 85b5a8efcc205d9739fc1a54481cb65bf18e4d81 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Sep 2014 19:16:12 +0200 Subject: [SimpleCrypter] Better built-in info --- module/plugins/internal/SimpleCrypter.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 0b99feb42..3cd52d9f1 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -24,7 +24,7 @@ class SimpleCrypter(Crypter): LINK_PATTERN: group(1) must be a download link or a regex to catch more links example: LINK_PATTERN = r'' + OFFLINE_PATTERN = r'>File does not exist on this server<' SH_COOKIES = [(".zippyshare.com", "ziplocale", "en")] def setup(self): self.multiDL = True + self.resumeDownload = True + def handleFree(self): - url = self.get_file_url() - if not url: - self.fail("Download URL not found.") + url = self.get_link() self.logDebug("Download URL: %s" % url) self.download(url) - def get_file_url(self): - """returns the absolute downloadable filepath""" - url_parts = re.search(r'(addthis:url="(http://www(\d+).zippyshare.com/v/(\d*)/file.html))', self.html) - number = url_parts.group(4) - check = re.search(r'