diff options
Diffstat (limited to 'module/plugins/hoster')
| -rw-r--r-- | module/plugins/hoster/BayfilesCom.py | 77 | ||||
| -rw-r--r-- | module/plugins/hoster/CzshareCom.py | 4 | ||||
| -rw-r--r-- | module/plugins/hoster/EnteruploadCom.py | 81 | ||||
| -rw-r--r-- | module/plugins/hoster/HellspyCz.py | 74 | 
4 files changed, 182 insertions, 54 deletions
| diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py new file mode 100644 index 000000000..c771f28c6 --- /dev/null +++ b/module/plugins/hoster/BayfilesCom.py @@ -0,0 +1,77 @@ +# -*- 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 <http://www.gnu.org/licenses/>. + +    @author: zoidberg +""" + +import re +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.ReCaptcha import ReCaptcha +from module.common.json_layer import json_loads +from time import time + +class BayfilesCom(SimpleHoster): +    __name__ = "BayfilesCom" +    __type__ = "hoster" +    __pattern__ = r"http://(?:www\.)?bayfiles\.com/file/\w+/\w+/.*" +    __version__ = "0.01" +    __description__ = """Bayfiles.com plugin - free only""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") + +    FILE_INFO_PATTERN = r'<p title="(?P<N>[^"]+)">[^<]*<strong>(?P<S>[0-9., ]+)(?P<U>[kKMG])i?B</strong></p>' +    FILE_OFFLINE_PATTERN = r'<p>The requested file could not be found.</p>' +     +    WAIT_PATTERN = r'>Your IP [0-9.]* has recently downloaded a file\. Upgrade to premium or wait (\d+) minutes\.<' +    VARS_PATTERN = r'var vfid = (\d+);\s*var delay = (\d+);' +    LINK_PATTERN = r"javascript:window.location.href = '([^']+)';" + +    def handleFree(self): +        found = re.search(self.WAIT_PATTERN, self.html) +        if found: +            self.setWait(int(found.group(1)) * 60) +            self.wait() +            self.retry() +         +        # Get download token +        found = re.search(self.VARS_PATTERN, self.html) +        if not found: self.parseError('VARS') +        vfid, delay = found.groups() +         +        response = json_loads(self.load('http://bayfiles.com/ajax_download', get = { +            "_": time() * 1000, +            "action": "startTimer", +            "vfid": vfid}, decode = True)) +         +        if not "token" in response or not response['token']:  +            self.fail('No token')     +         +        self.setWait(int(delay)) +        self.wait() +         +        self.html = self.load('http://bayfiles.com/ajax_download', get = { +            "token": response['token'], +            "action": "getLink", +            "vfid": vfid}) + +        # Get final link and download         +        found = re.search(self.LINK_PATTERN, self.html) +        if not found: self.parseError("Free link") +        url = found.group(1) +        self.logDebug("URL: " + url) + +        self.download(url) +         +getInfo = create_getInfo(BayfilesCom)
\ No newline at end of file diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 1a705e302..158fb0d1d 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -45,11 +45,11 @@ class CzshareCom(SimpleHoster):      __name__ = "CzshareCom"      __type__ = "hoster"      __pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/(\d+/|download.php\?).*" -    __version__ = "0.84" +    __version__ = "0.85"      __description__ = """CZshare.com"""      __author_name__ = ("zoidberg") -    SIZE_REPLACEMENTS = {',': '.', ' ': ''} +    SIZE_REPLACEMENTS = [(',', '.'), (' ', '')]      FREE_URL_PATTERN = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>'      FREE_FORM_PATTERN = r'<form action="download.php" method="post">\s*<img src="captcha.php" id="captcha" />(.*?)</form>'      PREMIUM_FORM_PATTERN = r'<form action="/profi_down.php" method="post">(.*?)</form>' diff --git a/module/plugins/hoster/EnteruploadCom.py b/module/plugins/hoster/EnteruploadCom.py new file mode 100644 index 000000000..5e899ae96 --- /dev/null +++ b/module/plugins/hoster/EnteruploadCom.py @@ -0,0 +1,81 @@ +# -*- 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 <http://www.gnu.org/licenses/>.
 +
 +    @author: zoidberg
 +"""
 +
 +import re
 +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 +
 +class EnteruploadCom(SimpleHoster):
 +    __name__ = "EnteruploadCom"
 +    __type__ = "hoster"
 +    __pattern__ = r"http://(?:www\.)?enterupload.com/\w+.*"
 +    __version__ = "0.01"
 +    __description__ = """EnterUpload.com plugin - free only"""
 +    __author_name__ = ("zoidberg")
 +    __author_mail__ = ("zoidberg@mujmail.cz")
 +
 +    FILE_INFO_PATTERN = r'<h3>(?P<N>[^<]+)</h3>\s*<span>File size:\s*(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?B</span>'
 +    FILE_OFFLINE_PATTERN = r'<(b|h2)>File Not Found</(b|h2)>|<font class="err">No such file with this filename</font>'   
 +    URL_REPLACEMENTS = [(r"(http://(?:www\.)?enterupload.com/\w+).*", r"\1")]
 +           
 +    FORM1_PATTERN = r'<form method="POST" action=\'\' style="display: none;">(.*?)</form>'
 +    FORM2_PATTERN = r'<form name="F1" method="POST"[^>]*>(.*?)</form>'
 +    FORM3_PATTERN = r'<form action="([^"]+)" method="get">'   
 +    FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]*)"[^>]*>'
 +    WAIT_PATTERN = r'<span id="countdown_str">Wait <[^>]*>(\d+)</span> seconds</span>'
 +
 +    def handleFree(self):
 +        # Page 1
 +        try:
 +            form = re.search(self.FORM1_PATTERN, self.html, re.DOTALL).group(1)
 +            inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
 +        except Exception, e:
 +            self.logError(e)
 +            self.parseError("Form 1")   
 +        
 +        inputs['method_free'] =	'Free Download'
 +        self.logDebug(inputs)
 +        self.html = self.load(self.pyfile.url, post = inputs, decode = True, cookies = True, ref = True)
 +
 +        # Page 2        
 +        try:
 +            form = re.search(self.FORM2_PATTERN, self.html, re.DOTALL).group(1)
 +            inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
 +        except Exception, e:
 +            self.logError(e)
 +            self.parseError("Form 2")
 +        
 +        inputs['method_free'] =	self.pyfile.url
 +        self.logDebug(inputs)
 +        
 +        found = re.search(self.WAIT_PATTERN, self.html)
 +        if found:
 +            self.setWait(int(found.group(1)) + 1)
 +            self.wait()
 +        
 +        self.html = self.load(self.pyfile.url, post = inputs, decode = True, cookies = True, ref = True)
 +        
 +        # Page 3
 +        found = re.search(self.FORM3_PATTERN, self.html)
 +        if not found: self.parseError("Form 3")
 +        url = found.group(1)
 +        
 +        # Download
 +        self.logDebug("Download URL: " + url)
 +        self.download(url, cookies = True, ref = True)
 +
 +getInfo = create_getInfo(EnteruploadCom)
\ No newline at end of file diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index 6d3f84b55..9a8817c54 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -17,83 +17,53 @@  """  import re -from math import ceil -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo -from module.network.RequestFactory import getURL - -def getInfo(urls): -    result = [] - -    for url in urls: -        file_info = parseFileInfo(HellspyCz, url, getURL(url, decode=True))  -        result.append(file_info) -             -    yield result +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo  class HellspyCz(SimpleHoster):      __name__ = "HellspyCz"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)*hellspy\.(?:cz|com|sk|hu)(/\S+/\d+)/?.*" -    __version__ = "0.22" +    __version__ = "0.23"      __description__ = """HellSpy.cz"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz")      FILE_INFO_PATTERN = '<span class="filesize right">(?P<S>[0-9.]+) <span>(?P<U>[kKMG])i?B</span></span>\s*<h1>(?P<N>[^<]+)</h1>'      FILE_OFFLINE_PATTERN = r'<h2>(404 - Page|File) not found</h2>' +    URL_REPLACEMENTS = [(r"http://(?:\w*\.)*hellspy\.(?:cz|com|sk|hu)(/\S+/\d+)/?.*", r"http://www.hellspy.com\1")] +          CREDIT_LEFT_PATTERN = r'<strong>Credits: </strong>\s*(\d+)' -    PREMIUM_URL_PATTERN = r'<a href="([^"]+)" class="ajax button button-blue button-download"'      DOWNLOAD_AGAIN_PATTERN = r'<a id="button-download-start"[^>]*title="You can download the file without deducting your credit.">' +    DOWNLOAD_URL_PATTERN = r"launchFullDownload\('([^']+)'"      def setup(self): -        self.resumeDownload = self.multiDL = True if self.account else False +        self.resumeDownload = self.multiDL = True          self.chunkLimit = 1 -    def process(self, pyfile): -        if not self.account: self.fail("Only premium users can download from HellSpy.cz") +    def handleFree(self): +        self.fail("Only premium users can download from HellSpy.cz") +    def handlePremium(self):                  # set PHPSESSID cookie          cj = self.account.getAccountCookies(self.user)          cj.setCookie(".hellspy.com", "PHPSESSID", self.account.phpsessid)          self.logDebug("PHPSESSID: " + cj.getCookie("PHPSESSID")) -        info = self.account.getAccountInfo(self.user) +        info = self.account.getAccountInfo(self.user, True)          self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"]/1024)) -        # load html -        rel_url = re.search(self.__pattern__, pyfile.url).group(1) -        self.html = self.load("http://www.hellspy.com/--%s-/%s" % (self.account.phpsessid, rel_url), decode = True) -         -        self.getFileInfo() +        if self.pyfile.size / 1024 > info["trafficleft"]: +            self.logWarning("Not enough credit left to download file")          # get premium download URL and download -        found = re.search(self.PREMIUM_URL_PATTERN, self.html) -        if not found: self.parseError('Download URL') -        download_url = "http://www.hellspy.cz" + found.group(1) -        self.logDebug("Download URL: " + download_url) -        self.download(download_url, disposition = True) - -        info = self.account.getAccountInfo(self.user) +        self.html = self.load(self.pyfile.url + "?download=1") +        found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) +        if not found: self.parseError("Download URL") +        url = found.group(1) +        self.logDebug("Download URL: " + url) +        self.download(url) + +        info = self.account.getAccountInfo(self.user, True)          self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"]/1024)) - -        """ -        # parse credits left info -        found = re.search(self.CREDIT_LEFT_PATTERN, self.html) -        if found is None: -            self.logInfo("Not logged in... relogin and retry") -            self.account.relogin(self.user) -            self.retry(max_tries = 2, reason = "Not logged in") -        credits_left = int(found.group(1)) -        self.logInfo("User %s has %i credits left" % (self.user, credits_left)) - -        # parse credit needed to proceed -        found = re.search(self.DOWNLOAD_AGAIN_PATTERN, self.html) -        if found: -            self.logInfo("Free download (file downloaded before)") -        else: -            found = re.search(self.FILE_CREDITS_PATTERN, self.html) -            if found is None: self.fail("Parse error (FILE CREDITS)") -            file_credits = int(found.group(3)) -            if file_credits > credits_left: self.fail("Not enough credits left to download file") -            self.logInfo("Premium download for %i credits" % file_credits) -        """ +         +getInfo = create_getInfo(HellspyCz)
\ No newline at end of file | 
