From 952395d3521ce94a41543d4bdc15f3b73a507397 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Tue, 3 Jan 2012 19:39:07 +0100 Subject: update mediafire, easybytez --- module/plugins/accounts/EasybytezCom.py | 68 ++++++++++++++++++++++++++++++++ module/plugins/hoster/EasybytezCom.py | 69 +++++++++++++++++++++++++++++---- module/plugins/hoster/MediafireCom.py | 6 +-- 3 files changed, 133 insertions(+), 10 deletions(-) create mode 100644 module/plugins/accounts/EasybytezCom.py (limited to 'module/plugins') diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py new file mode 100644 index 000000000..cf2b16394 --- /dev/null +++ b/module/plugins/accounts/EasybytezCom.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: zoidberg +""" + +from module.plugins.Account import Account +import re +from module.utils import parseFileSize +from time import mktime, strptime + +class EasybytezCom(Account): + __name__ = "EasybytezCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """EasyBytez.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + VALID_UNTIL_PATTERN = r'Premium account expire:([^<]+)' + TRAFFIC_LEFT_PATTERN = r'Traffic available today:(?P[^<]+)' + + def loadAccountInfo(self, user, req): + #self.relogin(user) + html = req.load("http://www.easybytez.com/?op=my_account", decode = True) + + validuntil = -1 + found = re.search(self.VALID_UNTIL_PATTERN, html) + if found: + premium = True + try: + self.logDebug(found.group(1)) + validuntil = mktime(strptime(found.group(1), "%d %B %Y")) + except Exception, e: + self.logError(e) + else: + premium = False + + #found = re.search(self.TRAFFIC_LEFT_PATTERN, html) + #trafficleft = parseFileSize(found.group('S')) / 1024 if found else 0 + #self.premium = True if trafficleft else False + trafficleft = -1 + + return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) + + def login(self, user, data, req): + html = req.load('http://www.easybytez.com/', post = { + "login": user, + "op": "login", + "password": data['password'], + "redirect": "http://easybytez.com/" + }, decode = True) + + if 'Incorrect Login or Password' in html: + self.wrongPassword() \ No newline at end of file diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index 5858dd935..dac35b1d3 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -18,12 +18,13 @@ import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from random import random class EasybytezCom(SimpleHoster): __name__ = "EasybytezCom" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)?easybytez.com/(\w+).*" - __version__ = "0.01" + __version__ = "0.03" __description__ = """easybytez.com""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") @@ -36,24 +37,78 @@ class EasybytezCom(SimpleHoster): FORM_INPUT_PATTERN = r']* name="([^"]+)" value="([^"]*)">' WAIT_PATTERN = r'[^>]*>(\d+) seconds' + DIRECT_LINK_PATTERN = r'(http://\w+\.easybytez\.com/files/\d+/\w+/[^"<]+)' + URL_FORM_PATTERN = r'
]*action="([^"]+)(.*?)
' + OVR_DOWNLOAD_LINK_PATTERN = r'

Download Link

\s*]*>([^<]+)' + OVR_KILL_LINK_PATTERN = r'

Delete Link

\s*]*>([^<]+)' + + def process(self, pyfile): + if not re.match(self.__pattern__, self.pyfile.url): + if self.premium: + self.handleOverriden() + else: + self.fail("Only premium users can download from other hosters with EasyBytes") + else: + self.html = self.load(pyfile.url, cookies = False, decode = True) + self.file_info = self.getFileInfo() + + header = self.load(self.pyfile.url, just_header = True, cookies = True) + self.logDebug(header) + + if 'location' in header and re.match(self.DIRECT_LINK_PATTERN, header['location']): + self.downloadLink(header['location']) + elif self.premium: + self.handlePremium() + else: + self.handleFree() + def handleFree(self): self.download(self.pyfile.url, post = self.getPostParameters(), ref = True, cookies = True) + + def handlePremium(self): + self.html = self.load(self.pyfile.url, post = self.getPostParameters(premium=True)) + found = re.search(self.DIRECT_LINK_PATTERN, self.html) + if not found: self.parseError('DIRECT LINK') + self.downloadLink(found.group(1)) + + def handleOverriden(self): + self.html = self.load('http://www.easybytez.com/') + action, form = re.search(self.URL_FORM_PATTERN, self.html, re.DOTALL).groups() + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + action += "%d&js_on=1&utype=prem&upload_type=url" % int(random()*10**12) + inputs['tos'] = '1' + inputs['url_mass'] = self.pyfile.url + + self.html = self.load(action, post = inputs) + found = re.search(self.OVR_DOWNLOAD_LINK_PATTERN, self.html) + if not found: self.parseError('DIRECT LINK (OVR)') + self.downloadLink(found.group(1)) - def getPostParameters(self): + def downloadLink(self, link): + self.logDebug('DIRECT LINK: %s' % link) + self.download(link) + + def getPostParameters(self, premium=False): inputs = dict(re.findall(self.FORM_INPUT_PATTERN, self.html)) self.logDebug(inputs) - inputs['method_free'] = "Free Download" inputs['referer'] = self.pyfile.url - if 'method_premium' in inputs: del inputs['method_premium'] + + if premium: + inputs['method_premium'] = "Premium Download" + if 'method_free' in inputs: del inputs['method_free'] + else: + inputs['method_free'] = "Free Download" + if 'method_premium' in inputs: del inputs['method_premium'] self.html = self.load(self.pyfile.url, post = inputs, ref = True, cookies = True) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, self.html)) self.logDebug(inputs) - found = re.search(self.WAIT_PATTERN, self.html) - self.setWait(int(found.group(1)) + 1 if found else 60) - self.wait() + if not premium: + found = re.search(self.WAIT_PATTERN, self.html) + self.setWait(int(found.group(1)) + 1 if found else 60) + self.wait() return inputs diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 484b48ba6..14180ff3d 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -58,20 +58,20 @@ class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)*mediafire\.com/[^?].*" - __version__ = "0.70" + __version__ = "0.71" __description__ = """Mediafire.com plugin - free only""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") DOWNLOAD_LINK_PATTERN = r'' def process(self, pyfile): -- cgit v1.2.3