diff options
Diffstat (limited to 'module/plugins')
167 files changed, 4341 insertions, 2934 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index f87a1c881..beaddeac9 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -3,10 +3,11 @@ import xml.dom.minidom as dom  from BeautifulSoup import BeautifulSoup
  from time import time
  import re
 +import urllib  class AlldebridCom(Account):
      __name__ = "AlldebridCom"
 -    __version__ = "0.2"
 +    __version__ = "0.21"
      __type__ = "account"
      __description__ = """AllDebrid.com account plugin"""
      __author_name__ = ("Andy, Voigt")
 @@ -16,25 +17,33 @@ class AlldebridCom(Account):          data = self.getAccountData(user)
          page = req.load("http://www.alldebrid.com/account/")
          soup=BeautifulSoup(page)
 -		#Try to parse expiration date directly from the control panel page (better accuracy)        
 +        #Try to parse expiration date directly from the control panel page (better accuracy)        
          try:
 -             time_text=soup.find('div',attrs={'class':'remaining_time_text'}).strong.string
 -             self.log.debug("Account expires in: %s" % time_text)
 -             p = re.compile('\d+')
 -             exp_data=p.findall(time_text)
 -             exp_time=time()+int(exp_data[0])*24*60*60+int(exp_data[1])*60*60+(int(exp_data[2])-1)*60
 -		#Get expiration date from API
 +            time_text=soup.find('div',attrs={'class':'remaining_time_text'}).strong.string
 +            self.log.debug("Account expires in: %s" % time_text)
 +            p = re.compile('\d+')
 +            exp_data=p.findall(time_text)
 +            exp_time=time()+int(exp_data[0])*24*60*60+int(exp_data[1])*60*60+(int(exp_data[2])-1)*60
 +        #Get expiration date from API
          except:
 -             data = self.getAccountData(user)
 -             page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" %  (user, data["password"]))
 -             self.log.debug(page)
 -             xml = dom.parseString(page)
 -             exp_time=time()+int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue)*86400
 +            data = self.getAccountData(user)
 +            page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" %  (user, data["password"]))
 +            self.log.debug(page)
 +            xml = dom.parseString(page)
 +            exp_time=time()+int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue)*86400
          account_info = {"validuntil": exp_time, "trafficleft": -1}
          return account_info
      def login(self, user, data, req):      
 -        page = req.load("http://www.alldebrid.com/register/?action=login&login_login=%s&login_password=%s" % (user, data["password"]))
 +     +        urlparams = urllib.urlencode({'action':'login','login_login':user,'login_password':data["password"]}) +        page = req.load("http://www.alldebrid.com/register/?%s" % (urlparams))          if "This login doesn't exist" in page:
 -             self.wrongPassword()
 +            self.wrongPassword()
 +              +        if "The password is not valid" in page: +            self.wrongPassword() +             +        if "Invalid captcha" in page: +            self.wrongPassword() diff --git a/module/plugins/accounts/BoltsharingCom.py b/module/plugins/accounts/BoltsharingCom.py new file mode 100644 index 000000000..678591d1d --- /dev/null +++ b/module/plugins/accounts/BoltsharingCom.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class BoltsharingCom(XFSPAccount): +    __name__ = "BoltsharingCom" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """Boltsharing.com account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") + +    MAIN_PAGE = "http://boltsharing.com/" diff --git a/module/plugins/accounts/CoolshareCz.py b/module/plugins/accounts/CoolshareCz.py deleted file mode 100644 index 03686c729..000000000 --- a/module/plugins/accounts/CoolshareCz.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- 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 -""" - -#shares code with WarserverCz - -from module.plugins.Account import Account -import re -from time import mktime, strptime - -class CoolshareCz(Account): -    __name__ = "CoolshareCz" -    __version__ = "0.01" -    __type__ = "account" -    __description__ = """CoolShare.cz account plugin""" -    __author_name__ = ("zoidberg") -    __author_mail__ = ("zoidberg@mujmail.cz") -     -    VALID_UNTIL_PATTERN = ur'<li>Neomezené stahování do: <strong>(.+?)<' -    TRAFFIC_LEFT_PATTERN = ur'<li>Kredit: <strong>.*?\(\s*(.+?)\s*B\)' -     -    DOMAIN = "http://www.coolshare.cz" - -    def loadAccountInfo(self, user, req):       -        html = req.load("%s/uzivatele/prehled" % self.DOMAIN, decode = True) -         -        validuntil = trafficleft = None -        premium = False -         -        found = re.search(self.VALID_UNTIL_PATTERN, html) -        if found: -            self.logDebug("VALID_UNTIL", found.group(1)) -            try:                 -                #validuntil = mktime(strptime(found.group(1), "%d %B %Y")) -                premium = True -                trafficleft = -1 -            except Exception, e: -                self.logError(e) -                 -        found = re.search(self.TRAFFIC_LEFT_PATTERN, html) -        if found: -            self.logDebug("TRAFFIC_LEFT", found.group(1)) -            trafficleft = int(found.group(1).replace(" ","")) // 1024 -            premium = True if trafficleft > 1 << 18 else False                            -         -        return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) -     -    def login(self, user, data, req): -        html = req.load('%s/uzivatele/prihlaseni?do=prihlaseni-submit' % self.DOMAIN,  -                        post = {"username": user, -                                "password": data['password'], -                                "send": u"Přihlásit"}, -                        decode = True) -         -        if '<p class="chyba">' in html:           -            self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/CramitIn.py b/module/plugins/accounts/CramitIn.py new file mode 100644 index 000000000..182c9d647 --- /dev/null +++ b/module/plugins/accounts/CramitIn.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class CramitIn(XFSPAccount): +    __name__ = "CramitIn" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """cramit.in account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    MAIN_PAGE = "http://cramit.in/"
\ No newline at end of file diff --git a/module/plugins/accounts/CyberlockerCh.py b/module/plugins/accounts/CyberlockerCh.py new file mode 100644 index 000000000..31e0c3e24 --- /dev/null +++ b/module/plugins/accounts/CyberlockerCh.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.SimpleHoster import parseHtmlForm + +class CyberlockerCh(XFSPAccount): +    __name__ = "CyberlockerCh" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """CyberlockerCh account plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    MAIN_PAGE = "http://cyberlocker.ch/" + +    def login(self, user, data, req): +        html = req.load(self.MAIN_PAGE + 'login.html', decode = True) + +        action, inputs = parseHtmlForm('name="FL"', html) +        if not inputs: +            inputs = {"op": "login", +                      "redirect": self.MAIN_PAGE} + +        inputs.update({"login": user, +                       "password": data['password']}) + +        # Without this a 403 Forbidden is returned +        req.http.lastURL = self.MAIN_PAGE + 'login.html' +        html = req.load(self.MAIN_PAGE, post = inputs, decode = True) + +        if 'Incorrect Login or Password' in html or '>Error<' in html: +            self.wrongPassword() diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 695e21b18..e68248aa8 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -24,7 +24,7 @@ import re  class CzshareCom(Account):      __name__ = "CzshareCom" -    __version__ = "0.1" +    __version__ = "0.11"      __type__ = "account"      __description__ = """czshare.com account plugin"""      __author_name__ = ("zoidberg") @@ -48,11 +48,11 @@ class CzshareCom(Account):      def login(self, user, data, req): -        html = req.load('http://czshare.com/index.php', post={ +        html = req.load('https://czshare.com/index.php', post={                  "Prihlasit": "Prihlasit",                  "login-password": data["password"],                  "login-name": user                  }) -        if "<p>You input a wrong user name or wrong password</p>" in html: +        if '<div class="login' in html:              self.wrongPassword() diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py new file mode 100644 index 000000000..d68f1c8a8 --- /dev/null +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +import re +import _strptime +import time + +from module.plugins.Account import Account + + +class DebridItaliaCom(Account): +    __name__ = "DebridItaliaCom" +    __version__ = "0.1" +    __type__ = "account" +    __description__ = """debriditalia.com account plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    WALID_UNTIL_PATTERN = r"Premium valid till: (?P<D>[^|]+) \|" + +    def loadAccountInfo(self, user, req): +        if 'Account premium not activated' in self.html: +            return {"premium": False, "validuntil": None, "trafficleft": None} + +        m = re.search(self.WALID_UNTIL_PATTERN, self.html) +        if m: +            validuntil = int(time.mktime(time.strptime(m.group('D'), "%d/%m/%Y %H:%M"))) +            return {"premium": True, "validuntil": validuntil, "trafficleft": -1} +        else: +            self.logError('Unable to retrieve account information - Plugin may be out of date') + +    def login(self, user, data, req): +        self.html = req.load("http://debriditalia.com/login.php", +                             get={"u": user, "p": data["password"]}) +        if 'NO' in self.html: +            self.wrongPassword() diff --git a/module/plugins/accounts/EgoFilesCom.py b/module/plugins/accounts/EgoFilesCom.py new file mode 100644 index 000000000..da1ed03ad --- /dev/null +++ b/module/plugins/accounts/EgoFilesCom.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account +import re +import time +from module.utils import parseFileSize + +class EgoFilesCom(Account): +    __name__ = "EgoFilesCom" +    __version__ = "0.2" +    __type__ = "account" +    __description__ = """egofiles.com account plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    PREMIUM_ACCOUNT_PATTERN = '<br/>\s*Premium: (?P<P>[^/]*) / Traffic left: (?P<T>[\d.]*) (?P<U>\w*)\s*\\n\s*<br/>' + +    def loadAccountInfo(self, user, req): +        html = req.load("http://egofiles.com") +        if 'You are logged as a Free User' in html: +            return {"premium": False, "validuntil": None, "trafficleft": None} + +        m = re.search(self.PREMIUM_ACCOUNT_PATTERN, html) +        if m: +            validuntil = int(time.mktime(time.strptime(m.group('P'), "%Y-%m-%d %H:%M:%S"))) +            trafficleft = parseFileSize(m.group('T'), m.group('U')) / 1024 +            return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} +        else: +            self.logError('Unable to retrieve account information - Plugin may be out of date') + +    def login(self, user, data, req): +        # Set English language +        req.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True) + +        html = req.load("http://egofiles.com/ajax/register.php", +                        post={"log": 1, +                              "loginV": user, +                              "passV": data["password"]}) +        if 'Login successful' not in html: +            self.wrongPassword() diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py new file mode 100644 index 000000000..42967d975 --- /dev/null +++ b/module/plugins/accounts/EuroshareEu.py @@ -0,0 +1,55 @@ +# -*- 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 +""" + +from module.plugins.Account import Account +from time import mktime, strptime +from string import replace +import re + +class EuroshareEu(Account): +    __name__ = "EuroshareEu" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """euroshare.eu account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") + +    def loadAccountInfo(self, user, req): +        self.relogin(user) +        html = req.load("http://euroshare.eu/customer-zone/settings/") +         +        found = re.search('id="input_expire_date" value="(\d+\.\d+\.\d+ \d+:\d+)"', html) +        if found is None: +            premium, validuntil = False, -1 +        else: +            premium = True +            validuntil = mktime(strptime(found.group(1), "%d.%m.%Y %H:%M")) +         +        return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} +     +    def login(self, user, data, req): +     +        html = req.load('http://euroshare.eu/customer-zone/login/', post={ +                "trvale": "1", +                "login": user, +                "password": data["password"] +                }, decode=True) +                 +        if u">Nesprávne prihlasovacie meno alebo heslo" in html: +            self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py new file mode 100644 index 000000000..333ee3761 --- /dev/null +++ b/module/plugins/accounts/FastshareCz.py @@ -0,0 +1,52 @@ +# -*- 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.Account import Account +from module.utils import parseFileSize + +class FastshareCz(Account): +    __name__ = "FastshareCz" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """fastshare.cz account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    def loadAccountInfo(self, user, req): +        html = req.load("http://www.fastshare.cz/user", decode = True) +                     +        found = re.search(r'Kredit: </td><td>(.+?) ', html)            +        if found: +            trafficleft = parseFileSize(found.group(1)) / 1024     +            premium = True if trafficleft else False +        else: +            trafficleft = None +            premium = False   + +        return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} +     +    def login(self, user, data, req): +        html = req.load('http://www.fastshare.cz/sql.php', post = { +            "heslo": data['password'], +            "login": user +            }, decode = True) +         +        if u'>Špatné uživatelské jméno nebo heslo.<' in html: +            self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/FilebeerInfo.py b/module/plugins/accounts/FilebeerInfo.py new file mode 100644 index 000000000..40ab70519 --- /dev/null +++ b/module/plugins/accounts/FilebeerInfo.py @@ -0,0 +1,57 @@ +# -*- 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 time import mktime, strptime +from module.plugins.Account import Account +from module.utils import parseFileSize + +class FilebeerInfo(Account): +    __name__ = "FilebeerInfo" +    __version__ = "0.02" +    __type__ = "account" +    __description__ = """filebeer.info account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    VALID_UNTIL_PATTERN = r'Reverts To Free Account:\s</td>\s*<td>\s*(.*?)\s*</td>' +     +    def loadAccountInfo(self, user, req): +        html = req.load("http://filebeer.info/upgrade.php", decode = True)         +        premium = not 'Free User </td>' in html +                 +        validuntil = None +        if premium: +            try: +                validuntil = mktime(strptime(re.search(self.VALID_UNTIL_PATTERN, html).group(1), "%d/%m/%Y %H:%M:%S"))  +            except Exception, e: +                self.logError("Unable to parse account info", e) + +        return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} +     +    def login(self, user, data, req): +        html = req.load('http://filebeer.info/login.php', post = { +            "submit": 'Login', +            "loginPassword": data['password'], +            "loginUsername": user, +            "submitme": '1' +            }, decode = True) +             +        if "<ul class='pageErrors'>" in html or ">Your username and password are invalid<" in html: +            self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/FilerioCom.py b/module/plugins/accounts/FilerioCom.py new file mode 100644 index 000000000..feacacaf5 --- /dev/null +++ b/module/plugins/accounts/FilerioCom.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class FilerioCom(XFSPAccount): +    __name__ = "FilerioCom" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """FileRio.in account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    MAIN_PAGE = "http://filerio.in/"
\ No newline at end of file diff --git a/module/plugins/accounts/FilesonicCom.py b/module/plugins/accounts/FilesonicCom.py deleted file mode 100644 index 1b0104b2a..000000000 --- a/module/plugins/accounts/FilesonicCom.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- 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: RaNaN -""" - -from time import mktime, strptime - -from module.plugins.Account import Account -from module.common.json_layer import json_loads - -class FilesonicCom(Account): -    __name__ = "FilesonicCom" -    __version__ = "0.31" -    __type__ = "account" -    __description__ = """filesonic.com account plugin""" -    __author_name__ = ("RaNaN", "Paul King") -    __author_mail__ = ("RaNaN@pyload.org", "") - -    API_URL = "http://api.filesonic.com" - -    def getDomain(self, req): -        xml = req.load(self.API_URL + "/utility?method=getFilesonicDomainForCurrentIp&format=json", -                       decode=True) -        return json_loads(xml)["FSApi_Utility"]["getFilesonicDomainForCurrentIp"]["response"] - -    def loadAccountInfo(self, req): -        xml = req.load(self.API_URL + "/user?method=getInfo&format=json", -                       post={"u": self.loginname, -                             "p": self.password}, decode=True) - -        self.logDebug("account status retrieved from api %s" % xml) - -        json = json_loads(xml) -        if json["FSApi_User"]["getInfo"]["status"] != "success": -            self.logError(_("Invalid login retrieving user details")) -            return {"validuntil": -1, "trafficleft": -1, "premium": False} -        premium = json["FSApi_User"]["getInfo"]["response"]["users"]["user"]["is_premium"] -        if premium: -            validuntil = json["FSApi_User"]["getInfo"]["response"]["users"]["user"]["premium_expiration"] -            validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) -        else: -            validuntil = -1 -        return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - -    def login(self, req): -        domain = self.getDomain(req) - -        post_vars = { -            "email": self.loginname, -            "password": self.password, -            "rememberMe": 1 -        } -        page = req.load("http://www%s/user/login" % domain, cookies=True, post=post_vars, decode=True) - -        if "Provided password does not match." in page or "You must be logged in to view this page." in page: -            self.wrongPassword() - diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index e51009f50..9b22cbafb 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -13,7 +13,7 @@      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  """ @@ -24,36 +24,39 @@ import re  class FshareVn(Account):      __name__ = "FshareVn" -    __version__ = "0.02" +    __version__ = "0.04"      __type__ = "account"      __description__ = """fshare.vn account plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -     +      VALID_UNTIL_PATTERN = ur'<dt>Thời hạn dùng:</dt>\s*<dd>([^<]+)</dd>' -    TRAFFIC_LEFT_PATTERN = ur'<dt>Bandwidth Còn Lại</dt>\s*<dd[^>]*>([0-9.]+) ([kKMG])B</dd>' +    TRAFFIC_LEFT_PATTERN = ur'<dt>Tổng Dung Lượng Tài Khoản</dt>\s*<dd[^>]*>([0-9.]+) ([kKMG])B</dd>'      DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>Kích hoạt download trực tiếp</dt>'      def loadAccountInfo(self, user, req): -        #self.relogin(user)          html = req.load("http://www.fshare.vn/account_info.php", decode = True) -                          found = re.search(self.VALID_UNTIL_PATTERN, html) -        validuntil = mktime(strptime(found.group(1), '%I:%M:%S %p %d-%m-%Y')) if found else 0 -         -        found = re.search(self.TRAFFIC_LEFT_PATTERN, html) -        trafficleft = float(found.group(1)) * 1024 ** {'k': 0, 'K': 0, 'M': 1, 'G': 2}[found.group(2)] if found else 0 -         -        return {"validuntil": validuntil, "trafficleft": trafficleft} -     +        if found: +            premium = True +            validuntil = mktime(strptime(found.group(1), '%I:%M:%S %p %d-%m-%Y')) +            found = re.search(self.TRAFFIC_LEFT_PATTERN, html) +            trafficleft = float(found.group(1)) * 1024 ** {'k': 0, 'K': 0, 'M': 1, 'G': 2}[found.group(2)] if found else 0 +        else: +            premium = False +            validuntil = None +            trafficleft = None + +        return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} +      def login(self, user, data, req): -        req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php")  -         +        req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") +          html = req.load('https://www.fshare.vn/login.php', post = {              "login_password" : data['password'],              "login_useremail" :	user,              "url_refe" : "https://www.fshare.vn/login.php"              }, referer = True, decode = True) -         -        if not '<img  alt="VIP"' in html: + +        if not '<img alt="VIP"' in html:              self.wrongPassword() diff --git a/module/plugins/accounts/Ftp.py b/module/plugins/accounts/Ftp.py new file mode 100644 index 000000000..9c1081662 --- /dev/null +++ b/module/plugins/accounts/Ftp.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account + +class Ftp(Account): +    __name__ = "Ftp" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """Ftp dummy account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    login_timeout = info_threshold = 1000000
\ No newline at end of file diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 8ed134f59..c7a918dec 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -19,16 +19,17 @@  from module.plugins.Account import Account  import re +import time  class HellshareCz(Account):      __name__ = "HellshareCz" -    __version__ = "0.12" +    __version__ = "0.14"      __type__ = "account"      __description__ = """hellshare.cz account plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -    CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+)</th>' +    CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+|\d\d\.\d\d\.)</th>'      def loadAccountInfo(self, user, req):          self.relogin(user) @@ -36,15 +37,45 @@ class HellshareCz(Account):          found = re.search(self.CREDIT_LEFT_PATTERN, html)          if found is None: -            credits = 0 +            trafficleft = None +            validuntil = None              premium = False          else: -            credits = int(found.group(1)) * 1024 +            credit = found.group(1)              premium = True +            try: +                if "." in credit: +                    #Time-based account +                    vt = [int(x) for x in credit.split('.')[:2]] +                    lt = time.localtime() +                    year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] == lt.tm_mon and vt[0] < lt.tm_mday)) +                    validuntil = time.mktime(time.strptime("%s%d 23:59:59" % (credit,year), "%d.%m.%Y %H:%M:%S"))  +                    trafficleft = -1 +                else: +                    #Traffic-based account +                    trafficleft = int(credit) * 1024 +                    validuntil = -1 +            except Exception, e: +                self.logError('Unable to parse credit info', e) +                validuntil = -1 +                trafficleft = -1 -        return {"validuntil": -1, "trafficleft": credits, "premium": premium} +        return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}      def login(self, user, data, req): +        html = req.load('http://www.hellshare.com/') +        if req.lastEffectiveURL != 'http://www.hellshare.com/': +            #Switch to English +            self.logDebug('Switch lang - URL: %s' % req.lastEffectiveURL) +            json = req.load("%s?do=locRouter-show" % req.lastEffectiveURL) +            hash = re.search(r"(--[0-9a-f]+-)", json).group(1) +            self.logDebug('Switch lang - HASH: %s' % hash) +            html = req.load('http://www.hellshare.com/%s/' % hash) + +        if re.search(self.CREDIT_LEFT_PATTERN, html): +            self.logDebug('Already logged in') +            return +          html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={                  "login": "Log in",                  "password": data["password"], diff --git a/module/plugins/accounts/Http.py b/module/plugins/accounts/Http.py new file mode 100644 index 000000000..805d19900 --- /dev/null +++ b/module/plugins/accounts/Http.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account + +class Http(Account): +    __name__ = "Http" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """Http dummy account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    login_timeout = info_threshold = 1000000
\ No newline at end of file diff --git a/module/plugins/accounts/MegauploadCom.py b/module/plugins/accounts/MegauploadCom.py deleted file mode 100644 index ff4f5971c..000000000 --- a/module/plugins/accounts/MegauploadCom.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- 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: mkaay -""" - -import re -from time import time - -from module.plugins.Account import Account - -class MegauploadCom(Account): -    __name__ = "MegauploadCom" -    __version__ = "0.12" -    __type__ = "account" -    __description__ = """megaupload account plugin""" -    __author_name__ = ("RaNaN") -    __author_mail__ = ("RaNaN@pyload.org") -     -    def loadAccountInfo(self, user, req): -        page = req.load("http://www.megaupload.com/?c=account&setlang=en", decode = True) -         -        premium = False if r'<div class="account_txt">Regular' in page else True -        validuntil = -1 -         -        if premium: -            found = re.search(r'class="account_txt">\s*(\d+)\s*(days|hours|minutes) remaining', page) -            if found: -                validuntil = time() + 60 * int(found.group(1)) * {"days": 1440, "hours": 60, "minutes": 1}[found.group(2)]              -     -            if '<div class="account_txt" id="ddltxt"> Deactivated </div>' in page: -                self.core.log.warning(_("Activate direct Download in your MegaUpload Account")) - -        return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - - -    def login(self, user, data, req): -        page = req.load("http://www.megaupload.com/?c=login&next=c%3Dpremium", post={ "username" : user, "password" : data["password"], "login" :"1"}, cookies=True) -        if "Username and password do not match" in page: -            self.wrongPassword() diff --git a/module/plugins/accounts/OronCom.py b/module/plugins/accounts/OronCom.py deleted file mode 100755 index 2c1d33162..000000000 --- a/module/plugins/accounts/OronCom.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- 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: DHMH -""" - -from module.plugins.Account import Account -import re -from time import strptime, mktime -from module.utils import formatSize, parseFileSize - -class OronCom(Account): -    __name__ = "OronCom" -    __version__ = "0.13" -    __type__ = "account" -    __description__ = """oron.com account plugin""" -    __author_name__ = ("DHMH") -    __author_mail__ = ("DHMH@pyload.org") - -    def loadAccountInfo(self, req): -        req.load("http://oron.com/?op=change_lang&lang=german") -        src = req.load("http://oron.com/?op=my_account").replace("\n", "") -        validuntil = re.search(r"<td>Premiumaccount läuft bis:</td>\s*<td>(.*?)</td>", src) -        if validuntil: -            validuntil = validuntil.group(1) -            validuntil = int(mktime(strptime(validuntil, "%d %B %Y"))) -            trafficleft = re.search(r'<td>Download Traffic verfügbar:</td>\s*<td>(.*?)</td>', src).group(1) -            self.logDebug("Oron left: " + formatSize(parseFileSize(trafficleft))) -            trafficleft = int(self.parseTraffic(trafficleft)) -            premium = True -        else: -            validuntil = -1 -            trafficleft = None -            premium = False -        tmp = {"validuntil": validuntil, "trafficleft": trafficleft, "premium" : premium} -        return tmp - -    def login(self, req): -        req.load("http://oron.com/?op=change_lang&lang=german") -        page = req.load("http://oron.com/login", post={"login": self.loginname, "password": self.password, "op": "login"}) -        if r'<b class="err">Login oder Passwort falsch</b>' in page: -            self.wrongPassword() - diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index 768fcd783..1a446b842 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -4,7 +4,7 @@ from module.common.json_layer import json_loads  class PremiumizeMe(Account):
      __name__ = "PremiumizeMe"
 -    __version__ = "0.1"
 +    __version__ = "0.11"
      __type__ = "account"
      __description__ = """Premiumize.Me account plugin"""
 @@ -15,10 +15,14 @@ class PremiumizeMe(Account):          # Get user data from premiumize.me
          status = self.getAccountStatus(user, req)
 +        self.logDebug(status)
          # Parse account info
          account_info = {"validuntil": float(status['result']['expires']),
 -                        "trafficleft": status['result']['trafficleft_bytes'] / 1024}
 +                        "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)}
 +
 +        if status['result']['type'] == 'free':
 +            account_info['premium'] = False
          return account_info
 @@ -37,4 +41,4 @@ class PremiumizeMe(Account):          # Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) to retrieve account info and return the parsed json answer
          answer = req.load("https://api.premiumize.me/pm-api/v1.php?method=accountstatus¶ms[login]=%s¶ms[pass]=%s" % (user, self.accounts[user]['password']))            
          return json_loads(answer)
 -        
\ No newline at end of file +        
 diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py new file mode 100644 index 000000000..94649cc43 --- /dev/null +++ b/module/plugins/accounts/QuickshareCz.py @@ -0,0 +1,53 @@ +# -*- 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.Account import Account +from module.utils import parseFileSize + +class QuickshareCz(Account): +    __name__ = "QuickshareCz" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """quickshare.cz account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    def loadAccountInfo(self, user, req): +        html = req.load("http://www.quickshare.cz/premium", decode = True) +                     +        found = re.search(r'Stav kreditu: <strong>(.+?)</strong>', html)                    +        if found: +            trafficleft = parseFileSize(found.group(1)) / 1024    +            premium = True if trafficleft else False +        else: +            trafficleft = None +            premium = False   + +        return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} +     +    def login(self, user, data, req): +        html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', post = { +            "akce": u'Přihlásit', +            "heslo": data['password'], +            "jmeno": user +            }, decode = True) +         +        if u'>Takový uživatel neexistuje.<' in html or u'>Špatné heslo.<' in html: +            self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py new file mode 100644 index 000000000..74825a0f9 --- /dev/null +++ b/module/plugins/accounts/RapidgatorNet.py @@ -0,0 +1,74 @@ +# -*- 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.Account import Account +from module.utils import parseFileSize +from module.common.json_layer import json_loads + +class RapidgatorNet(Account): +    __name__ = "RapidgatorNet" +    __version__ = "0.03" +    __type__ = "account" +    __description__ = """rapidgator.net account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    API_URL = 'http://rapidgator.net/api/user' +         +    def loadAccountInfo(self, user, req): +        try: +            sid = self.getAccountData(user).get('SID')  +            assert sid +             +            json = req.load("%s/info?sid=%s" % (self.API_URL, sid)) +            self.logDebug("API:USERINFO", json)             +            json = json_loads(json) +                         +            if json['response_status'] == 200: +                if "reset_in" in json['response']: +                    self.scheduleRefresh(user, json['response']['reset_in']) +                                                     +                return {"validuntil": json['response']['expire_date'],  +                        "trafficleft": json['response']['traffic_left'] / 1024,  +                        "premium": True} +            else: +                self.logError(json['response_details']) +        except Exception, e: +            self.logError(e) + +        return {"validuntil": None, "trafficleft": None, "premium": False} +     +    def login(self, user, data, req):                               +        try: +            json = req.load('%s/login' % self.API_URL,  +                post = {"username": user, +                        "password": data['password']})             +            self.logDebug("API:LOGIN", json) +            json = json_loads(json)             +         +            if json['response_status'] == 200: +                data['SID'] = str(json['response']['session_id']) +                return             +            else: +                self.logError(json['response_details']) +        except Exception, e: +            self.logError(e) +             +        self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/RarefileNet.py b/module/plugins/accounts/RarefileNet.py new file mode 100644 index 000000000..57f293c55 --- /dev/null +++ b/module/plugins/accounts/RarefileNet.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class RarefileNet(XFSPAccount): +    __name__ = "RarefileNet" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """RareFile.net account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    MAIN_PAGE = "http://rarefile.in/"
\ No newline at end of file diff --git a/module/plugins/accounts/ReloadCc.py b/module/plugins/accounts/ReloadCc.py new file mode 100644 index 000000000..e4cb32c42 --- /dev/null +++ b/module/plugins/accounts/ReloadCc.py @@ -0,0 +1,73 @@ +from module.plugins.Account   import Account + +from module.common.json_layer import json_loads + +from module.network.HTTPRequest import BadHeader + +class ReloadCc(Account): +    __name__ = "ReloadCc" +    __version__ = "0.3" +    __type__ = "account" +    __description__ = """Reload.Cc account plugin""" + +    __author_name__ = ("Reload Team") +    __author_mail__ = ("hello@reload.cc") + +    def loadAccountInfo(self, user, req): + +        # Get user data from reload.cc +        status = self.getAccountStatus(user, req) + +        # Parse account info +        account_info = {"validuntil": float(status['msg']['expires']), +                        "pwdhash": status['msg']['hash'], +                        "trafficleft": -1} + +        return account_info + +    def login(self, user, data, req): + +        # Get user data from reload.cc +        status = self.getAccountStatus(user, req) + +        if not status: +            raise Exception("There was an error upon logging in to Reload.cc!") + +        # Check if user and password are valid +        if status['status'] != "ok": +            self.wrongPassword() + + +    def getAccountStatus(self, user, req): +        # Use reload.cc API v1 to retrieve account info and return the parsed json answer +        query_params = dict( +            via='pyload', +            v=1, +            get_traffic='true', +            user=user +        ) + +        try: +            query_params.update(dict(hash=self.infos[user]['pwdhash'])) +        except Exception: +            query_params.update(dict(pwd=self.accounts[user]['password'])) + +        try: +            answer = req.load("http://api.reload.cc/login", get=query_params) +        except BadHeader, e: +            if e.code == 400: +                raise Exception("There was an unknown error within the Reload.cc plugin.") +            elif e.code == 401: +                self.wrongPassword() +            elif e.code == 402: +                self.expired(user) +            elif e.code == 403: +                raise Exception("Your account is disabled. Please contact the Reload.cc support!") +            elif e.code == 409: +                self.empty(user) +            elif e.code == 503: +                self.logInfo("Reload.cc is currently in maintenance mode! Please check again later.") +                self.wrongPassword() +            return None + +        return json_loads(answer) diff --git a/module/plugins/accounts/Share76Com.py b/module/plugins/accounts/Share76Com.py new file mode 100644 index 000000000..9c946ae50 --- /dev/null +++ b/module/plugins/accounts/Share76Com.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class Share76Com(XFSPAccount): +    __name__ = "Share76Com" +    __version__ = "0.02" +    __type__ = "account" +    __description__ = """Share76.com account plugin""" +    __author_name__ = ("me") + +    MAIN_PAGE = "http://Share76.com/" diff --git a/module/plugins/accounts/ShareFilesCo.py b/module/plugins/accounts/ShareFilesCo.py new file mode 100644 index 000000000..0d8ea6635 --- /dev/null +++ b/module/plugins/accounts/ShareFilesCo.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class ShareFilesCo(XFSPAccount): +    __name__ = "ShareFilesCo" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """ShareFilesCo account plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    MAIN_PAGE = "http://sharefiles.co/" diff --git a/module/plugins/accounts/ShareRapidCom.py b/module/plugins/accounts/ShareRapidCom.py index aad229475..f8043449c 100644 --- a/module/plugins/accounts/ShareRapidCom.py +++ b/module/plugins/accounts/ShareRapidCom.py @@ -1,24 +1,37 @@  # -*- coding: utf-8 -*-  import re +from time import mktime, strptime  from module.plugins.Account import Account  class ShareRapidCom(Account):      __name__ = "ShareRapidCom" -    __version__ = "0.31" +    __version__ = "0.32"      __type__ = "account"      __description__ = """ShareRapid account plugin""" -    __author_name__ = ("MikyWoW") - +    __author_name__ = ("MikyWoW", "zoidberg") +     +    login_timeout = 60 +              def loadAccountInfo(self, user, req): -        src = req.load("http://share-rapid.com/mujucet/", cookies=True) +        src = req.load("http://share-rapid.com/mujucet/", decode=True) +         +        found = re.search(ur'<td>Max. počet paralelních stahování: </td><td>(\d+)', src) +        if found: +            data = self.getAccountData(user) +            data["options"]["limitDL"] = [int(found.group(1))] +         +        found = re.search(ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>', src) +        if found: +            validuntil = mktime(strptime(found.group(1), "%d.%m.%Y - %H:%M")) +            return {"premium": True, "trafficleft": -1, "validuntil": validuntil}         +                  found = re.search(r'<tr><td>GB:</td><td>(.*?) GB', src)          if found: -            ret = float(found.group(1)) * (1 << 20) -            tmp = {"premium": True, "trafficleft": ret, "validuntil": -1} -        else: -            tmp = {"premium": False, "trafficleft": None, "validuntil": None} -        return tmp +            trafficleft = float(found.group(1)) * (1 << 20) +            return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} +         +        return {"premium": False, "trafficleft": None, "validuntil": None}      def login(self, user, data, req):          htm = req.load("http://share-rapid.com/prihlaseni/", cookies=True) @@ -27,8 +40,8 @@ class ShareRapidCom(Account):              htm = htm[start+33:]              hashes = htm[0:32]              htm = req.load("http://share-rapid.com/prihlaseni/", -                post={"hash": hashes,"login": user, "pass1": data["password"],"remember": 0, -                      "sbmt": "P%C5%99ihl%C3%A1sit"}, cookies=True) -             -            #if "Heslo:" in htm: -            #    self.wrongPassword()
\ No newline at end of file +                           post={"hash": hashes, +                                 "login": user,  +                                 "pass1": data["password"], +                                 "remember": 0, +                                 "sbmt": u"Přihlásit"}, cookies=True)
\ No newline at end of file diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 4dd398d6d..fe2b412db 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -18,58 +18,39 @@  """  from module.plugins.Account import Account -from time import strptime, mktime -import re  class ShareonlineBiz(Account):      __name__ = "ShareonlineBiz" -    __version__ = "0.3" +    __version__ = "0.24"      __type__ = "account"      __description__ = """share-online.biz account plugin""" -    __author_name__ = ("mkaay") -    __author_mail__ = ("mkaay@mkaay.de") -     -    def getUserAPI(self, req): -        src = req.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=userDetails" % (self.loginname, self.password)) +    __author_name__ = ("mkaay", "zoidberg") +    __author_mail__ = ("mkaay@mkaay.de", "zoidberg@mujmail.cz") + +    def getUserAPI(self, user, req): +        return req.load("http://api.share-online.biz/account.php", +            {"username": user, "password": self.accounts[user]["password"], "act": "userDetails"}) + +    def loadAccountInfo(self, user, req): +        src = self.getUserAPI(user, req) +          info = {}          for line in src.splitlines(): -            key, value = line.split("=") -            info[key] = value -        return info -     -    def loadAccountInfo(self, user, req): -        try: -            info = self.getUserAPI(req) -            return {"validuntil": int(info["expire_date"]), "trafficleft": -1, "premium": not info["group"] == "Sammler"} -        except: -            pass -         -        #fallback -        src = req.load("http://www.share-online.biz/members.php?setlang=en") -        validuntil = re.search(r'<td align="left"><b>Package Expire Date:</b></td>\s*<td align="left">(\d+/\d+/\d+)</td>', src) -        if validuntil: -            validuntil = int(mktime(strptime(validuntil.group(1), "%m/%d/%y"))) -        else: -            validuntil = -1 -         -        acctype = re.search(r'<td align="left" ><b>Your Package:</b></td>\s*<td align="left">\s*<b>(.*?)</b>\s*</td>', src) -        if acctype: -            if acctype.group(1) == "Collector account (free)": -                premium = False -            else: -                premium = True +            if "=" in line: +                key, value = line.split("=") +                info[key] = value +        self.logDebug(info) + +        if "dl" in info and info["dl"].lower() != "not_available": +            req.cj.setCookie("share-online.biz", "dl", info["dl"]) +        if "a" in info and info["a"].lower() != "not_available": +            req.cj.setCookie("share-online.biz", "a", info["a"]) + +        return {"validuntil": int(info["expire_date"]) if "expire_date" in info else -1, +                "trafficleft": -1, +                "premium": True if ("dl" in info or "a" in info) and (info["group"] != "Sammler") else False} -        tmp = {"validuntil": validuntil, "trafficleft": -1, "premium": premium} -        return tmp -              def login(self, user, data, req): -        post_vars = { -                        "act": "login", -                        "location": "index.php", -                        "dieseid": "", -                        "user": user, -                        "pass": data["password"], -                        "login": "Login" -                    } -        req.lastURL = "http://www.share-online.biz/" -        req.load("https://www.share-online.biz/login.php", cookies=True, post=post_vars) +        src = self.getUserAPI(user, req) +        if "EXCEPTION" in src: +            self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/SpeedLoadOrg.py b/module/plugins/accounts/SpeedLoadOrg.py new file mode 100644 index 000000000..4eb2b52de --- /dev/null +++ b/module/plugins/accounts/SpeedLoadOrg.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class SpeedLoadOrg(XFSPAccount): +    __name__ = "SpeedLoadOrg" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """SpeedLoadOrg account plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    MAIN_PAGE = "http://speedload.org/" diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 0c4ecda6a..6652c8b7c 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -5,19 +5,19 @@ import re  class UlozTo(Account):      __name__ = "UlozTo" -    __version__ = "0.03" +    __version__ = "0.04"      __type__ = "account"      __description__ = """uloz.to account plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -    TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="/kredit/" title="[^"]*?GB = ([0-9.]+) MB">' +    TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="http://www.ulozto.net/kredit" title="[^"]*?GB = ([0-9.]+) MB"'      def loadAccountInfo(self, user, req):          #this cookie gets lost somehow after each request -        self.phpsessid = req.cj.getCookie("PHPSESSID")  +        self.phpsessid = req.cj.getCookie("ULOSESSID")           html = req.load("http://www.ulozto.net/", decode = True) -        req.cj.setCookie("www.ulozto.net", "PHPSESSID", self.phpsessid)         +        req.cj.setCookie("www.ulozto.net", "ULOSESSID", self.phpsessid)                  found = re.search(self.TRAFFIC_LEFT_PATTERN, html)          trafficleft = int(float(found.group(1).replace(' ','').replace(',','.')) * 1000 / 1.024) if found else 0 @@ -33,4 +33,4 @@ class UlozTo(Account):              }, decode = True)          if '<ul class="error">' in html: -            self.wrongPassword()
\ No newline at end of file +            self.wrongPassword() diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py new file mode 100644 index 000000000..b07991817 --- /dev/null +++ b/module/plugins/accounts/UptoboxCom.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class UptoboxCom(XFSPAccount): +    __name__ = "UptoboxCom" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """DDLStorage.com account plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    MAIN_PAGE = "http://uptobox.com/"
\ No newline at end of file diff --git a/module/plugins/accounts/WarserverCz.py b/module/plugins/accounts/WarserverCz.py index b3cafdb5f..21961956b 100644 --- a/module/plugins/accounts/WarserverCz.py +++ b/module/plugins/accounts/WarserverCz.py @@ -17,17 +17,54 @@      @author: zoidberg  """ -from module.plugins.accounts.CoolshareCz import CoolshareCz +from module.plugins.Account import Account  import re  from module.utils import parseFileSize  from time import mktime, strptime -class WarserverCz(CoolshareCz): +class WarserverCz(Account):      __name__ = "WarserverCz" -    __version__ = "0.01" +    __version__ = "0.02"      __type__ = "account"      __description__ = """Warserver.cz account plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -    DOMAIN = "http://www.warserver.cz"
\ No newline at end of file +    VALID_UNTIL_PATTERN = ur'<li>Neomezené stahování do: <strong>(.+?)<' +    TRAFFIC_LEFT_PATTERN = ur'<li>Kredit: <strong>(.+?)<' +     +    DOMAIN = "http://www.warserver.cz" + +    def loadAccountInfo(self, user, req):       +        html = req.load("%s/uzivatele/prehled" % self.DOMAIN, decode = True) +         +        validuntil = trafficleft = None +        premium = False +         +        found = re.search(self.VALID_UNTIL_PATTERN, html) +        if found: +            self.logDebug("VALID_UNTIL", found.group(1)) +            try:                 +                #validuntil = mktime(strptime(found.group(1), "%d %B %Y")) +                premium = True +                trafficleft = -1 +            except Exception, e: +                self.logError(e) +                 +        found = re.search(self.TRAFFIC_LEFT_PATTERN, html) +        if found: +            self.logDebug("TRAFFIC_LEFT", found.group(1)) +            trafficleft = parseFileSize((found.group(1).replace(" ",""))) // 1024 +            premium = True if trafficleft > 1 << 18 else False                            +         +        return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) +     +    def login(self, user, data, req): +        html = req.load('%s/uzivatele/prihlaseni?do=prihlaseni-submit' % self.DOMAIN,  +                        post = {"username": user, +                                "password": data['password'], +                                "send": u"Přihlásit"}, +                        decode = True) +         +        if '<p class="chyba">' in html:           +            self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/addons/AlldebridCom.py b/module/plugins/addons/AlldebridCom.py index f9657ed8c..6818b8c43 100644 --- a/module/plugins/addons/AlldebridCom.py +++ b/module/plugins/addons/AlldebridCom.py @@ -7,33 +7,22 @@ from module.plugins.internal.MultiHoster import MultiHoster  class AlldebridCom(MultiHoster):      __name__ = "AlldebridCom" -    __version__ = "0.11" +    __version__ = "0.13"      __type__ = "hook"      __config__ = [("activated", "bool", "Activated", "False"),                    ("https", "bool", "Enable HTTPS", "False"),                    ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), -                  ("hosterList", "str", "Hoster list (comma separated)", "")] +                  ("hosterList", "str", "Hoster list (comma separated)", ""), +                  ("unloadFailing", "bool", "Revert to stanard download if download fails", "False"), +                  ("interval", "int", "Reload interval in hours (0 to disable)", "24")]      __description__ = """Real-Debrid.com hook plugin"""      __author_name__ = ("Andy, Voigt")      __author_mail__ = ("spamsales@online.de") -    replacements = [("freakshare.net", "freakshare.com")] -      def getHoster(self):          https = "https" if self.getConfig("https") else "http"          page = getURL(https + "://www.alldebrid.com/api.php?action=get_host").replace("\"","").strip() -        hosters = set([x.strip() for x in page.split(",") if x.strip()]) -         -        configMode = self.getConfig('hosterListMode') -        if configMode in ("listed", "unlisted"): -            configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) -            configList.discard(u'') -            if configMode == "listed": -                hosters &= configList -            else: -                hosters -= configList -         -        return list(hosters) +        return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/addons/CaptchaBrotherhood.py b/module/plugins/addons/CaptchaBrotherhood.py index a22a5ee1d..bdf547827 100644 --- a/module/plugins/addons/CaptchaBrotherhood.py +++ b/module/plugins/addons/CaptchaBrotherhood.py @@ -44,7 +44,7 @@ class CaptchaBrotherhoodException(Exception):  class CaptchaBrotherhood(Hook):      __name__ = "CaptchaBrotherhood" -    __version__ = "0.03" +    __version__ = "0.04"      __description__ = """send captchas to CaptchaBrotherhood.com"""      __config__ = [("activated", "bool", "Activated", False),                    ("username", "str", "Username", ""), @@ -53,7 +53,7 @@ class CaptchaBrotherhood(Hook):      __author_name__ = ("RaNaN", "zoidberg")      __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz") -    API_URL = "http://ocrhood.gazcad.com/" +    API_URL = "http://www.captchabrotherhood.com/"      def setup(self):          self.info = {} diff --git a/module/plugins/addons/Checksum.py b/module/plugins/addons/Checksum.py index aec4bd0d7..b290838bb 100644 --- a/module/plugins/addons/Checksum.py +++ b/module/plugins/addons/Checksum.py @@ -19,7 +19,8 @@  from __future__ import with_statement  import hashlib, zlib  from os import remove -from os.path import getsize, isfile +from os.path import getsize, isfile, splitext +import re  from module.utils import save_join, fs_encode  from module.plugins.Hook import Hook @@ -50,7 +51,7 @@ def computeChecksum(local_file, algorithm):  class Checksum(Hook):      __name__ = "Checksum" -    __version__ = "0.06" +    __version__ = "0.07"      __description__ = "Verify downloaded file size and checksum (enable in general preferences)"      __config__ = [("activated", "bool", "Activated", True),                    ("action", "fail;retry;nothing", "What to do if check fails?", "retry"), @@ -58,12 +59,19 @@ class Checksum(Hook):      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") +    methods = { 'sfv':'crc32', 'crc': 'crc32', 'hash': 'md5'} +    regexps = { 'sfv': r'^(?P<name>[^;].+)\s+(?P<hash>[0-9A-Fa-f]{8})$', +                'md5': r'^(?P<name>[0-9A-Fa-f]{32})  (?P<file>.+)$', +                'crc': r'filename=(?P<name>.+)\nsize=(?P<size>\d+)\ncrc32=(?P<hash>[0-9A-Fa-f]{8})$',   +                'default': r'^(?P<hash>[0-9A-Fa-f]+)\s+\*?(?P<name>.+)$' } +          def setup(self):     -        self.algorithms = sorted(getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse = True) -        self.algorithms.extend(["crc32", "adler32"]) -                  if not self.config['general']['checksum']: -            self.logInfo("Checksum validation is disabled in general configuration")                                   +            self.logInfo("Checksum validation is disabled in general configuration") + +        self.algorithms = sorted(getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse = True) +        self.algorithms.extend(["crc32", "adler32"])                     +        self.formats = self.algorithms + ['sfv', 'crc', 'hash']                                         def downloadFinished(self, pyfile):          """  @@ -127,4 +135,35 @@ class Checksum(Hook):          elif action == "retry":              if local_file:                  remove(local_file) -            pyfile.plugin.retry(reason = msg, max_tries = self.getConfig("max_tries"))
\ No newline at end of file +            pyfile.plugin.retry(reason = msg, max_tries = self.getConfig("max_tries")) + +            +    def packageFinished(self, pypack): +        download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "") +         +        for link in pypack.getChildren().itervalues(): +            file_type = splitext(link["name"])[1][1:].lower() +            #self.logDebug(link, file_type) +             +            if file_type not in self.formats: +                continue +             +            hash_file = fs_encode(save_join(download_folder, link["name"]))    +            if not isfile(hash_file): +                self.logWarning("File not found: %s" % link["name"]) +                continue +                 +            with open(hash_file) as f: +                text = f.read() +                 +            for m in re.finditer(self.regexps.get(file_type, self.regexps['default']), text): +                data = m.groupdict()  +                self.logDebug(link["name"], data) +                                +                local_file = fs_encode(save_join(download_folder, data["name"])) +                algorithm = self.methods.get(file_type, file_type) +                checksum = computeChecksum(local_file, algorithm) +                if checksum == data["hash"]: +                    self.logInfo('File integrity of "%s" verified by %s checksum (%s).' % (data["name"], algorithm, checksum)) +                else: +                    self.logWarning("%s checksum for file %s does not match (%s != %s)" % (algorithm, data["name"], checksum, data["hash"]))
\ No newline at end of file diff --git a/module/plugins/addons/EasybytezCom.py b/module/plugins/addons/EasybytezCom.py index 21a988555..6a4ded85b 100644 --- a/module/plugins/addons/EasybytezCom.py +++ b/module/plugins/addons/EasybytezCom.py @@ -4,14 +4,9 @@ from module.network.RequestFactory import getURL  from module.plugins.internal.MultiHoster import MultiHoster  import re -def getConfigSet(option): -    s = set(option.lower().replace(',','|').split('|')) -    s.discard(u'') -    return s -  class EasybytezCom(MultiHoster):      __name__ = "EasybytezCom" -    __version__ = "0.02" +    __version__ = "0.03"      __type__ = "hook"      __config__ = [("activated", "bool", "Activated", "False"),                    ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), @@ -21,16 +16,16 @@ class EasybytezCom(MultiHoster):      __author_mail__ = ("zoidberg@mujmail.cz")      def getHoster(self): - -        hoster = set(['2shared.com', 'easy-share.com', 'filefactory.com', 'fileserve.com', 'filesonic.com', 'hotfile.com', 'mediafire.com', 'megaupload.com', 'netload.in', 'rapidshare.com', 'uploading.com', 'wupload.com', 'oron.com', 'uploadstation.com', 'ul.to', 'uploaded.to'])    +        self.account = self.core.accountManager.getAccountPlugin(self.__name__) +        user = self.account.selectAccount()[0] -        configMode = self.getConfig('hosterListMode') -        if configMode in ("listed", "unlisted"): -            configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) -            configList.discard(u'') -            if configMode == "listed": -                hoster &= configList -            else: -                hoster -= configList +        try: +            req = self.account.getAccountRequest(user) +            page = req.load("http://www.easybytez.com") -        return list(hoster)
\ No newline at end of file +            found = re.search(r'</textarea>\s*Supported sites:(.*)', page) +            return found.group(1).split(',') +        except Exception, e: +            self.logDebug(e) +            self.logWarning("Unable to load supported hoster list, using last known") +            return ['bitshare.com', 'crocko.com', 'ddlstorage.com', 'depositfiles.com', 'extabit.com', 'hotfile.com', 'mediafire.com', 'netload.in', 'rapidgator.net', 'rapidshare.com', 'uploading.com', 'uload.to', 'uploaded.to']
\ No newline at end of file diff --git a/module/plugins/addons/ExternalScripts.py b/module/plugins/addons/ExternalScripts.py index 00fc7c114..8f5a5841e 100644 --- a/module/plugins/addons/ExternalScripts.py +++ b/module/plugins/addons/ExternalScripts.py @@ -26,7 +26,7 @@ from module.utils.fs import save_join, exists, join, listdir  class ExternalScripts(Addon):      __name__ = "ExternalScripts" -    __version__ = "0.21" +    __version__ = "0.22"      __description__ = """Run external scripts"""      __config__ = [("activated", "bool", "Activated", "True")]      __author_name__ = ("mkaay", "RaNaN", "spoob") @@ -84,7 +84,7 @@ class ExternalScripts(Addon):      def downloadFinished(self, pyfile):          for script in self.scripts['download_finished']: -            self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.name, pyfile.id, +            self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.name,                              save_join(self.core.config['general']['download_folder'], pyfile.package().folder, pyfile.name),                              pyfile.id) @@ -94,7 +94,7 @@ class ExternalScripts(Addon):              folder = self.core.config['general']['download_folder']              folder = save_join(folder, pypack.folder) -            self.callScript(script, pypack.name, folder, pypack.id) +            self.callScript(script, pypack.name, folder, pypack.password, pypack.id)      def beforeReconnecting(self, ip):          for script in self.scripts['before_reconnect']: diff --git a/module/plugins/addons/ExtractArchive.py b/module/plugins/addons/ExtractArchive.py index 5f749ed0d..369b20ba9 100644 --- a/module/plugins/addons/ExtractArchive.py +++ b/module/plugins/addons/ExtractArchive.py @@ -195,8 +195,6 @@ class ExtractArchive(Addon):                  files_ids = new_files_ids # also check extracted files              if not matched: self.logInfo(_("No files found to extract")) -	 -      def startExtracting(self, plugin, fid, passwords, thread):          pyfile = self.core.files.getFile(fid) diff --git a/module/plugins/addons/LinkdecrypterCom.py b/module/plugins/addons/LinkdecrypterCom.py index ac939afd9..2cb91d120 100644 --- a/module/plugins/addons/LinkdecrypterCom.py +++ b/module/plugins/addons/LinkdecrypterCom.py @@ -24,31 +24,36 @@ from module.utils import remove_chars  class LinkdecrypterCom(Hook):      __name__ = "LinkdecrypterCom" -    __version__ = "0.14" +    __version__ = "0.16"      __description__ = """linkdecrypter.com - regexp loader"""      __config__ = [ ("activated", "bool", "Activated" , "True") ]      __author_name__ = ("zoidberg") -     +      def coreReady(self):          page = getURL("http://linkdecrypter.com/") -        m = re.search(r'<b>Supported</b>: <i>([^+<]*)', page) +        m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', page)          if not m:              self.logError(_("Crypter list not found"))              return -             -        online = m.group(1).split(', ')             +          builtin = [ name.lower() for name in self.core.pluginManager.crypterPlugins.keys() ]          builtin.extend([ "downloadserienjunkiesorg" ]) -                -        online = [ crypter.replace(".", "\\.") for crypter in online if remove_chars(crypter, "-.") not in builtin ] + +        crypter_pattern = re.compile("(\w[\w.-]+)") +        online = [] +        for crypter in m.group(1).split(', '): +            m = re.match(crypter_pattern, crypter) +            if m and remove_chars(m.group(1), "-.") not in builtin: +                online.append(m.group(1).replace(".", "\\.")) +          if not online:              self.logError(_("Crypter list is empty"))              return -        regexp = r"https?://([^.]+\.)*?(%s)/.*" % "|".join(online) +        regexp = r"http://([^.]+\.)*?(%s)/.*" % "|".join(online)          dict = self.core.pluginManager.crypterPlugins[self.__name__]          dict["pattern"] = regexp          dict["re"] = re.compile(regexp) -        self.logDebug("REGEXP: " + regexp)
\ No newline at end of file +        self.logDebug("REGEXP: " + regexp) diff --git a/module/plugins/addons/MultishareCz.py b/module/plugins/addons/MultishareCz.py index a00c6cb2b..7e5a3e007 100644 --- a/module/plugins/addons/MultishareCz.py +++ b/module/plugins/addons/MultishareCz.py @@ -4,14 +4,9 @@ from module.network.RequestFactory import getURL  from module.plugins.internal.MultiHoster import MultiHoster  import re -def getConfigSet(option): -    s = set(option.lower().split('|')) -    s.discard(u'') -    return s -  class MultishareCz(MultiHoster):      __name__ = "MultishareCz" -    __version__ = "0.03" +    __version__ = "0.04"      __type__ = "hook"      __config__ = [("activated", "bool", "Activated", "False"),          ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), @@ -20,21 +15,9 @@ class MultishareCz(MultiHoster):      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -    replacements = [("share-rapid.cz", "sharerapid.com")]      HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="([^"]+)"></td>\s*<td class="stav">[^>]*?alt="OK"'      def getHoster(self):          page = getURL("http://www.multishare.cz/monitoring/") -        hosters = set(h.lower().strip() for h in re.findall(self.HOSTER_PATTERN, page))  -         -        configMode = self.getConfig('hosterListMode') -        if configMode in ("listed", "unlisted"): -            configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) -            configList.discard(u'') -            if configMode == "listed": -                hosters &= configList -            elif configMode == "unlisted": -                hosters -= configList -         -        return list(hosters)
\ No newline at end of file +        return re.findall(self.HOSTER_PATTERN, page)
\ No newline at end of file diff --git a/module/plugins/addons/Premium4Me.py b/module/plugins/addons/Premium4Me.py index fc3ce2343..b49eb41a9 100644 --- a/module/plugins/addons/Premium4Me.py +++ b/module/plugins/addons/Premium4Me.py @@ -15,23 +15,10 @@ class Premium4Me(MultiHoster):      __author_name__ = ("RaNaN", "zoidberg")
      __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
 -    replacements = [("freakshare.net", "freakshare.com")]
 -
      def getHoster(self):
          page = getURL("http://premium4.me/api/hosters.php?authcode=%s" % self.account.authcode)
 -        hosters = set([x.strip() for x in page.replace("\"", "").split(";")])
 -        
 -        configMode = self.getConfig('hosterListMode')
 -        if configMode in ("listed", "unlisted"):
 -            configList = set(self.getConfig('hosterList').strip().lower().replace(',','|').split('|'))
 -            configList.discard(u'')
 -            if configMode == "listed":
 -                hosters &= configList
 -            elif configMode == "unlisted":
 -                hosters -= configList
 -        
 -        return list(hosters)
 +        return [x.strip() for x in page.replace("\"", "").split(";")]
      def coreReady(self):
 diff --git a/module/plugins/addons/PremiumizeMe.py b/module/plugins/addons/PremiumizeMe.py index 3825e9219..a10c24f85 100644 --- a/module/plugins/addons/PremiumizeMe.py +++ b/module/plugins/addons/PremiumizeMe.py @@ -5,20 +5,18 @@ from module.network.RequestFactory import getURL  class PremiumizeMe(MultiHoster):      __name__ = "PremiumizeMe" -    __version__ = "0.1" +    __version__ = "0.12"      __type__ = "hook"      __description__ = """Premiumize.Me hook plugin"""      __config__ = [("activated", "bool", "Activated", "False"),                    ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"),  -                  ("hosterList", "str", "Hoster list (comma separated)", "")] +                  ("hosterList", "str", "Hoster list (comma separated)", ""), +                  ("unloadFailing", "bool", "Revert to stanard download if download fails", "False"), +                  ("interval", "int", "Reload interval in hours (0 to disable)", "24")]      __author_name__ = ("Florian Franzen")      __author_mail__ = ("FlorianFranzen@gmail.com") - -    replacements = [("freakshare.net", "freakshare.com")] - -    interval = 0 # Disable periodic calls, we dont use them anyway      def getHoster(self):               # If no accounts are available there will be no hosters available @@ -38,20 +36,7 @@ class PremiumizeMe(MultiHoster):              return []          # Extract hosters from json file  -        hosters = set(data['result']['hosterlist']) -     -                 -        # Read config to check if certain hosters should not be handled -        configMode = self.getConfig('hosterListMode') -        if configMode in ("listed", "unlisted"): -            configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) -            configList.discard(u'') -            if configMode == "listed": -                hosters &= configList -            else: -                hosters -= configList -         -        return list(hosters)       +        return data['result']['hosterlist']       def coreReady(self):          # Get account plugin and check if there is a valid account available diff --git a/module/plugins/addons/RealdebridCom.py b/module/plugins/addons/RealdebridCom.py index bd3179673..be74b47c3 100644 --- a/module/plugins/addons/RealdebridCom.py +++ b/module/plugins/addons/RealdebridCom.py @@ -5,32 +5,21 @@ from module.plugins.internal.MultiHoster import MultiHoster  class RealdebridCom(MultiHoster):      __name__ = "RealdebridCom" -    __version__ = "0.41" +    __version__ = "0.43"      __type__ = "hook"      __config__ = [("activated", "bool", "Activated", "False"),                    ("https", "bool", "Enable HTTPS", "False"),                    ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), -                  ("hosterList", "str", "Hoster list (comma separated)", "")] +                  ("hosterList", "str", "Hoster list (comma separated)", ""), +                  ("unloadFailing", "bool", "Revert to stanard download if download fails", "False"), +                  ("interval", "int", "Reload interval in hours (0 to disable)", "24")]      __description__ = """Real-Debrid.com hook plugin"""      __author_name__ = ("Devirex, Hazzard")      __author_mail__ = ("naibaf_11@yahoo.de") -    replacements = [("freakshare.net", "freakshare.com")] -      def getHoster(self):          https = "https" if self.getConfig("https") else "http"          page = getURL(https + "://real-debrid.com/api/hosters.php").replace("\"","").strip() -        hosters = set([x.strip() for x in page.split(",") if x.strip()]) -         -        configMode = self.getConfig('hosterListMode') -        if configMode in ("listed", "unlisted"): -            configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) -            configList.discard(u'') -            if configMode == "listed": -                hosters &= configList -            else: -                hosters -= configList -         -        return list(hosters) +        return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/addons/RehostTo.py b/module/plugins/addons/RehostTo.py index b16987f5c..7ca5e5cde 100644 --- a/module/plugins/addons/RehostTo.py +++ b/module/plugins/addons/RehostTo.py @@ -5,17 +5,19 @@ from module.plugins.internal.MultiHoster import MultiHoster  class RehostTo(MultiHoster):      __name__ = "RehostTo" -    __version__ = "0.41" +    __version__ = "0.42"      __type__ = "hook" -    __config__ = [("activated", "bool", "Activated", "False")] +    __config__ = [("activated", "bool", "Activated", "False"), +                  ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), +                  ("hosterList", "str", "Hoster list (comma separated)", ""), +                  ("unloadFailing", "bool", "Revert to stanard download if download fails", "False"), +                  ("interval", "int", "Reload interval in hours (0 to disable)", "24")]      __description__ = """rehost.to hook plugin"""      __author_name__ = ("RaNaN")      __author_mail__ = ("RaNaN@pyload.org") -    replacements = [("freakshare.net", "freakshare.com")] -      def getHoster(self):          page = getURL("http://rehost.to/api.php?cmd=get_supported_och_dl&long_ses=%s" % self.long_ses) @@ -36,4 +38,4 @@ class RehostTo(MultiHoster):          self.ses = data["ses"]          self.long_ses = data["long_ses"] -        return MultiHoster.coreReady(self) +        return MultiHoster.coreReady(self)
\ No newline at end of file diff --git a/module/plugins/addons/UpdateManager.py b/module/plugins/addons/UpdateManager.py index 5bc6ac447..c800b44bf 100644 --- a/module/plugins/addons/UpdateManager.py +++ b/module/plugins/addons/UpdateManager.py @@ -23,25 +23,27 @@ from os import stat  from os.path import join, exists  from time import time -from module.plugins.PluginManager import IGNORE +from module.ConfigParser import IGNORE  from module.network.RequestFactory import getURL -from module.plugins.Addon import threaded, Expose, Addon +from module.plugins.Hook import threaded, Expose, Hook -class UpdateManager(Addon): +class UpdateManager(Hook):      __name__ = "UpdateManager" -    __version__ = "0.12" +    __version__ = "0.13"      __description__ = """checks for updates"""      __config__ = [("activated", "bool", "Activated", "True"), -        ("interval", "int", "Check interval in minutes", "360"), +        ("interval", "int", "Check interval in minutes", "480"),          ("debug", "bool", "Check for plugin changes when in debug mode", False)]      __author_name__ = ("RaNaN")      __author_mail__ = ("ranan@pyload.org") +    URL = "http://get.pyload.org/check2/%s/" +    MIN_TIME = 3 * 60 * 60 # 3h minimum check interval +      @property      def debug(self):          return self.core.debug and self.getConfig("debug") -      def setup(self):          if self.debug:              self.logDebug("Monitoring file changes") @@ -51,26 +53,20 @@ class UpdateManager(Addon):              self.periodical = self.checkChanges              self.mtimes = {}  #recordes times          else: -            self.interval = self.getConfig("interval") * 60 +            self.interval = max(self.getConfig("interval") * 60, self.MIN_TIME)          self.updated = False          self.reloaded = True +        self.version = "None"          self.info = {"pyload": False, "plugins": False}      @threaded      def periodical(self): -        if self.core.version.endswith("-dev"): -            self.logDebug("No update check performed on dev version.") -            return - -        update = self.checkForUpdate() -        if update: -            self.info["pyload"] = True -        else: -            self.log.info(_("No Updates for pyLoad")) -            self.checkPlugins() +        updates = self.checkForUpdate() +        if updates: +            self.checkPlugins(updates)          if self.updated and not self.reloaded:              self.info["plugins"] = True @@ -78,7 +74,7 @@ class UpdateManager(Addon):          elif self.updated and self.reloaded:              self.log.info(_("Plugins updated and reloaded"))              self.updated = False -        else: +        elif self.version == "None":              self.log.info(_("No plugin updates available"))      @Expose @@ -87,57 +83,63 @@ class UpdateManager(Addon):          self.periodical()      def checkForUpdate(self): -        """checks if an update is available""" +        """checks if an update is available, return result"""          try: -            version_check = getURL("http://get.pyload.org/check/%s/" % self.core.api.getServerVersion()) -            if version_check == "": -                return False -            else: -                self.log.info(_("***  New pyLoad Version %s available  ***") % version_check) -                self.log.info(_("***  Get it here: http://pyload.org/download  ***")) -                return True +            if self.version == "None": # No updated known +                version_check = getURL(self.URL % self.core.api.getServerVersion()).splitlines() +                self.version = version_check[0] + +                # Still no updates, plugins will be checked +                if self.version == "None": +                    self.log.info(_("No Updates for pyLoad")) +                    return version_check[1:] + + +            self.info["pyload"] = True +            self.log.info(_("***  New pyLoad Version %s available  ***") % self.version) +            self.log.info(_("***  Get it here: http://pyload.org/download  ***")) +          except:              self.log.warning(_("Not able to connect server for updates")) -            return False + +        return None # Nothing will be done -    def checkPlugins(self): +    def checkPlugins(self, updates):          """ checks for plugins updates"""          # plugins were already updated          if self.info["plugins"]: return -        try: -            updates = getURL("http://get.pyload.org/plugins/check/") -        except: -            self.log.warning(_("Not able to connect server for updates")) -            return False - -        updates = updates.splitlines()          reloads = []          vre = re.compile(r'__version__.*=.*("|\')([0-9.]+)') +        url = updates[0] +        schema = updates[1].split("|") +        updates = updates[2:]          for plugin in updates: -            path, version = plugin.split(":") -            prefix, filename = path.split("/") +            info = dict(zip(schema, plugin.split("|"))) +            filename = info["name"] +            prefix = info["type"] +            version = info["version"]              if filename.endswith(".pyc"):                  name = filename[:filename.find("_")]              else:                  name = filename.replace(".py", "") -	    #TODO: obsolete +            #TODO: obsolete in 0.5.0              if prefix.endswith("s"):                  type = prefix[:-1]              else:                  type = prefix -            plugins = self.core.pluginManager.getPlugins(type) +            plugins = getattr(self.core.pluginManager, "%sPlugins" % type)              if name in plugins: -                if float(plugins[name].version) >= float(version): +                if float(plugins[name]["v"]) >= float(version):                      continue              if name in IGNORE or (type, name) in IGNORE: @@ -150,7 +152,7 @@ class UpdateManager(Addon):              })              try: -                content = getURL("http://get.pyload.org/plugins/get/" + path) +                content = getURL(url % info)              except Exception, e:                  self.logWarning(_("Error when updating %s") % filename, str(e))                  continue @@ -171,7 +173,7 @@ class UpdateManager(Addon):      def checkChanges(self): -        if self.last_check + self.getConfig("interval") * 60 < time(): +        if self.last_check + max(self.getConfig("interval") * 60, self.MIN_TIME) < time():              self.old_periodical()              self.last_check = time() diff --git a/module/plugins/addons/XFileSharingPro.py b/module/plugins/addons/XFileSharingPro.py index 3981db2d0..105c70113 100644 --- a/module/plugins/addons/XFileSharingPro.py +++ b/module/plugins/addons/XFileSharingPro.py @@ -5,7 +5,7 @@ import re  class XFileSharingPro(Hook):      __name__ = "XFileSharingPro" -    __version__ = "0.03" +    __version__ = "0.04"      __type__ = "hook"      __config__ = [ ("activated" , "bool" , "Activated"  , "True"),                     ("loadDefault", "bool", "Include default (built-in) hoster list" , "True"), @@ -25,29 +25,25 @@ class XFileSharingPro(Hook):          if self.getConfig('loadDefault'):                      hosterList |= set((              #WORKING HOSTERS: -            "azsharing.com", "banashare.com", "fileband.com", "kingsupload.com", "migahost.com", "ryushare.com", "xfileshare.eu", -            #NOT TESTED: -            "aieshare.com", "amonshare.com", "asixfiles.com",    -            "bebasupload.com", "boosterking.com", "buckshare.com", "bulletupload.com", "crocshare.com", "ddlanime.com", "divxme.com",  -            "dopeshare.com", "downupload.com", "eyesfile.com", "eyvx.com", "fik1.com", "file4safe.com", "file4sharing.com",  -            "fileforth.com", "filemade.com", "filemak.com", "fileplaygroud.com", "filerace.com", "filestrack.com",  -            "fileupper.com", "filevelocity.com", "fooget.com", "4bytez.com", "freefilessharing.com", "glumbouploads.com", "grupload.com",  -            "heftyfile.com", "hipfile.com", "host4desi.com", "hulkshare.com", "idupin.com", "imageporter.com", "isharefast.com",  -            "jalurcepat.com", "laoupload.com", "linkzhost.com", "loombo.com", "maknyos.com",  -            "mlfat4arab.com", "movreel.com", "netuploaded.com", "ok2upload.com", "180upload.com", "1hostclick.com", "ovfile.com",  -            "putshare.com", "pyramidfiles.com", "q4share.com", "queenshare.com", "ravishare.com", "rockdizfile.com", "sendmyway.com",  +            "aieshare.com", "asixfiles.com", "banashare.com", "cyberlocker.ch", "eyesfile.co", "eyesfile.com", +            "fileband.com", "filedwon.com", "filedownloads.org", "hipfile.com", "kingsupload.com", "mlfat4arab.com",  +            "netuploaded.com", "odsiebie.pl", "q4share.com", "ravishare.com", "uptobox.com", "verzend.be",   +            #NOT TESTED:             +            "bebasupload.com", "boosterking.com", "divxme.com", "filevelocity.com", "glumbouploads.com", "grupload.com", "heftyfile.com",  +            "host4desi.com", "laoupload.com", "linkzhost.com", "movreel.com", "rockdizfile.com", "limfile.com"              "share76.com", "sharebeast.com", "sharehut.com", "sharerun.com", "shareswift.com", "sharingonline.com", "6ybh-upload.com",  -            "skipfile.com", "spaadyshare.com", "space4file.com", "speedoshare.com", "uploadbaz.com", "uploadboost.com", "uploadc.com",  -            "uploaddot.com", "uploadfloor.com", "uploadic.com", "uploadville.com", "uptobox.com", "vidbull.com", "zalaa.com",  +            "skipfile.com", "spaadyshare.com", "space4file.com", "uploadbaz.com", "uploadc.com",  +            "uploaddot.com", "uploadfloor.com", "uploadic.com", "uploadville.com", "vidbull.com", "zalaa.com",               "zomgupload.com", "kupload.org", "movbay.org", "multishare.org", "omegave.org", "toucansharing.org", "uflinq.org",              "banicrazy.info", "flowhot.info", "upbrasil.info", "shareyourfilez.biz", "bzlink.us", "cloudcache.cc", "fileserver.cc" -            "farshare.to", "kingshare.to", "filemaze.ws", "filehost.ws", "goldfile.eu", "filestock.ru", "moidisk.ru" -            "4up.me", "kfiles.kz", "odsiebie.pl", "upchi.co.il", "upit.in", "verzend.be" -            )) -             +            "farshare.to", "filemaze.ws", "filehost.ws", "filestock.ru", "moidisk.ru", "4up.im", "100shared.com", +            #WRONG FILE NAME: +            "sendmyway.com", "upchi.co.il", "180upload.com",               #NOT WORKING: -            """ -            """                 +            "amonshare.com", "imageporter.com", "file4safe.com", +            #DOWN OR BROKEN: +            "ddlanime.com", "fileforth.com", "loombo.com", "goldfile.eu", "putshare.com" +            ))                       hosterList -= (excludeList)          hosterList -= set(('', u'')) diff --git a/module/plugins/addons/ZeveraCom.py b/module/plugins/addons/ZeveraCom.py index 46c752c21..cadf60069 100644 --- a/module/plugins/addons/ZeveraCom.py +++ b/module/plugins/addons/ZeveraCom.py @@ -5,29 +5,15 @@ from module.plugins.internal.MultiHoster import MultiHoster  class ZeveraCom(MultiHoster):      __name__ = "ZeveraCom" -    __version__ = "0.01" +    __version__ = "0.02"      __type__ = "hook"      __config__ = [("activated", "bool", "Activated", "False"),                    ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),                    ("hosterList", "str", "Hoster list (comma separated)", "")]      __description__ = """Real-Debrid.com hook plugin""" -    __author_name__ = ("Devirex, Hazzard") -    __author_mail__ = ("naibaf_11@yahoo.de") - -    replacements = [("freakshare.net", "freakshare.com"), ("2shared.com", "twoshared.com"), ("4shared.com", "fourshared.com"), -                    ("easy-share.com", "crocko.com"), ("hellshare.com", "hellshare.cz")] +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz")      def getHoster(self):          page = getURL("http://www.zevera.com/jDownloader.ashx?cmd=gethosters")         -        hosters = set([x.strip() for x in page.replace("\"", "").split(",")])    -         -        configMode = self.getConfig('hosterListMode') -        if configMode in ("listed", "unlisted"): -            configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) -            configList.discard(u'') -            if configMode == "listed": -                hosters &= configList -            else: -                hosters -= configList -         -        return list(hosters)                                
\ No newline at end of file +        return [x.strip() for x in page.replace("\"", "").split(",")]                           
\ No newline at end of file diff --git a/module/plugins/hoster/UploadhereCom.py b/module/plugins/crypter/Dereferer.py index 8deec1397..584835e18 100644 --- a/module/plugins/hoster/UploadhereCom.py +++ b/module/plugins/crypter/Dereferer.py @@ -1,4 +1,5 @@  # -*- 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 @@ -12,23 +13,22 @@      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  """ -from module.plugins.internal.DeadHoster import DeadHoster as UploadkingCom, create_getInfo -#from module.plugins.internal.SimpleHoster import create_getInfo -#from UploadkingCom import UploadkingCom +import re +import urllib -class UploadhereCom(UploadkingCom): -    __name__ = "UploadhereCom" -    __type__ = "hoster" -    __pattern__ = r"http://(?:www\.)?uploadhere\.com/\w{10}" -    __version__ = "0.12" -    __description__ = """Uploadhere.com plugin - free only""" +from module.plugins.Crypter import Crypter + +class Dereferer(Crypter): +    __name__ = "Dereferer" +    __type__ = "crypter" +    __pattern__ = r'https?://([^/]+)/.*?(?P<url>(ht|f)tps?(://|%3A%2F%2F).*)' +    __version__ = "0.1" +    __description__ = """Crypter for dereferers"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -    # shares code with UploadkingCom - -create_getInfo(UploadhereCom)
\ No newline at end of file +    def decrypt(self, pyfile): +        link = re.match(self.__pattern__, self.pyfile.url).group('url') +        self.core.files.addLinks([ urllib.unquote(link).rstrip('+') ], self.pyfile.package().id) diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index 6e7166ff8..4886d24db 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -8,7 +8,7 @@ class DuckCryptInfo(Crypter):      __name__ = "DuckCryptInfo"      __type__ = "container"      __pattern__ = r"http://(?:www\.)?duckcrypt.info/(folder|wait|link)/(\w+)/?(\w*)" -    __version__ = "0.01" +    __version__ = "0.02"      __description__ = """DuckCrypt.Info Container Plugin"""      __author_name__ = ("godofdream")      __author_mail__ = ("soilfiction@gmail.com") @@ -39,12 +39,13 @@ class DuckCryptInfo(Crypter):          self.logDebug("Redirectet to " + str(found.group(0)))          src = self.load(str(found.group(0)))          soup = BeautifulSoup(src) -        cryptlinks = soup.find("div", attrs={"class": "folderbox"}).findAll("a") +        cryptlinks = soup.findAll("div", attrs={"class": "folderbox"})          self.logDebug("Redirectet to " + str(cryptlinks))          if not cryptlinks:              self.fail('no links found - (Plugin out of date?)')          for clink in cryptlinks: -            self.handleLink(clink['href']) +            if clink.find("a"): +                self.handleLink(clink.find("a")['href'])      def handleLink(self, url):          src = self.load(url) diff --git a/module/plugins/crypter/FilebeerInfoFolder.py b/module/plugins/crypter/FilebeerInfoFolder.py new file mode 100644 index 000000000..f45144f14 --- /dev/null +++ b/module/plugins/crypter/FilebeerInfoFolder.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter + +class FilebeerInfoFolder(Crypter): +    __name__ = "FilebeerInfoFolder" +    __type__ = "crypter" +    __pattern__ = r"http://(?:www\.)?filebeer\.info/(\d+~f).*" +    __version__ = "0.01" +    __description__ = """Filebeer.info Folder Plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") + +    LINK_PATTERN = r'<td title="[^"]*"><a href="([^"]+)" target="_blank">' +    PAGE_COUNT_PATTERN = r'<p class="introText">\s*Total Pages (\d+)' +     +    def decrypt(self, pyfile):         +        pyfile.url = re.sub(self.__pattern__, r'http://filebeer.info/\1?page=1', pyfile.url)         +        html = self.load(pyfile.url) +         +        page_count = int(re.search(self.PAGE_COUNT_PATTERN, html).group(1)) +        new_links = [] +                 +        for i in range(1, page_count + 1):             +            self.logInfo("Fetching links from page %i" % i)                 +            new_links.extend(re.findall(self.LINK_PATTERN, html)) +                         +            if i < page_count: +                html = self.load("%s?page=%d" % (pyfile.url, i+1)) + +        if new_links: +            self.core.files.addLinks(new_links, self.pyfile.package().id) +        else: +            self.fail('Could not extract any links')
\ No newline at end of file diff --git a/module/plugins/crypter/FilesonicComFolder.py b/module/plugins/crypter/FilesonicComFolder.py deleted file mode 100644 index 02ae66295..000000000 --- a/module/plugins/crypter/FilesonicComFolder.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from module.plugins.Crypter import Crypter - -class FilesonicComFolder(Crypter): -    __pattern__ = r"http://(\w*\.)?(sharingmatrix|filesonic|wupload)\.[^/]*/folder/\w+/?" -    __version__ = "0.11" -    __description__ = """Filesonic.com/Wupload.com Folder Plugin""" -    __author_name__ = ("zoidberg") -    __author_mail__ = ("zoidberg@mujmail.cz") - -    FOLDER_PATTERN = r'<table>\s*<caption>Files Folder</caption>(.*?)</table>' -    LINK_PATTERN = r'<a href="([^"]+)">' - -    def decryptURL(self, url): -        html = self.load(url) -        new_links = [] - -        folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) -        if not folder: self.fail("Parse error (FOLDER)") - -        new_links.extend(re.findall(self.LINK_PATTERN, folder.group(1))) - -        if new_links: -            return new_links -        else: -            self.fail('Could not extract any links') - diff --git a/module/plugins/crypter/LetitbitNetFolder.py b/module/plugins/crypter/LetitbitNetFolder.py new file mode 100644 index 000000000..68aad9dd7 --- /dev/null +++ b/module/plugins/crypter/LetitbitNetFolder.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter + + +class LetitbitNetFolder(Crypter): +    __name__ = "LetitbitNetFolder" +    __type__ = "crypter" +    __pattern__ = r"http://(?:www\.)?letitbit.net/folder/\w+" +    __version__ = "0.1" +    __description__ = """Letitbit.net Folder Plugin""" +    __author_name__ = ("DHMH", "z00nx") +    __author_mail__ = ("webmaster@pcProfil.de", "z00nx0@gmail.com") + +    FOLDER_PATTERN = r'<table>(.*)</table>' +    LINK_PATTERN = r'<a href="([^"]+)" target="_blank">' + +    def decrypt(self, pyfile): +        html = self.load(self.pyfile.url) + +        new_links = [] + +        folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) +        if folder is None: +            self.fail("Parse error (FOLDER)") + +        new_links.extend(re.findall(self.LINK_PATTERN, folder.group(0))) + +        if new_links: +            self.core.files.addLinks(new_links, self.pyfile.package().id) +        else: +            self.fail('Could not extract any links') diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py index 2d568c592..30cc61055 100644 --- a/module/plugins/crypter/LinkSaveIn.py +++ b/module/plugins/crypter/LinkSaveIn.py @@ -97,10 +97,10 @@ class LinkSaveIn(Crypter):          self.html = self.load(self.pyfile.url, post=post)
      def unlockCaptchaProtection(self):
 -        hash = re.search(r'name="hash" value="([^"]+)', self.html).group(1)
 -        captchaUrl = re.search(r'src=".(/captcha/cap.php\?hsh=[^"]+)', self.html).group(1)
 -        code = self.decryptCaptcha("http://linksave.in" + captchaUrl, forceUser=True)
 -        self.html = self.load(self.pyfile.url, post={"id": self.fileid, "hash": hash, "code": code})   
 +        captcha_hash = re.search(r'name="hash" value="([^"]+)', self.html).group(1)
 +        captcha_url = re.search(r'src=".(/captcha/cap.php\?hsh=[^"]+)', self.html).group(1)
 +        captcha_code = self.decryptCaptcha("http://linksave.in" + captcha_url, forceUser=True)
 +        self.html = self.load(self.pyfile.url, post={"id": self.fileid, "hash": captcha_hash, "code": captcha_code})   
      def getPackageInfo(self):
          name = self.pyfile.package().name
 @@ -141,11 +141,11 @@ class LinkSaveIn(Crypter):              pattern = r'<a href="http://linksave\.in/(\w{43})"'
              ids = re.findall(pattern, self.html)
              self.logDebug("Decrypting %d Web links" % len(ids))
 -            for i, id in enumerate(ids):
 +            for i, weblink_id in enumerate(ids):
                  try:
 -                    webLink = "http://linksave.in/%s" % id
 +                    webLink = "http://linksave.in/%s" % weblink_id
                      self.logDebug("Decrypting Web link %d, %s" % (i+1, webLink))
 -                    fwLink = "http://linksave.in/fw-%s" % id
 +                    fwLink = "http://linksave.in/fw-%s" % weblink_id
                      response = self.load(fwLink)
                      jscode = re.findall(r'<script type="text/javascript">(.*)</script>', response)[-1]
                      jseval = self.js.eval("document = { write: function(e) { return e; } }; %s" % jscode)
 diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index ff21916ef..69d2f8192 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -22,79 +22,79 @@ from module.plugins.Crypter import Crypter  class LinkdecrypterCom(Crypter):      __name__ = "LinkdecrypterCom"      __type__ = "crypter" -    __version__ = "0.26" +    __version__ = "0.27"      __description__ = """linkdecrypter.com"""      __author_name__ = ("zoidberg", "flowlee") -     +      TEXTAREA_PATTERN = r'<textarea name="links" wrap="off" readonly="1" class="caja_des">(.+)</textarea>'      PASSWORD_PATTERN = r'<input type="text" name="password"'      CAPTCHA_PATTERN = r'<img class="captcha" src="(.+?)"(.*?)>'      REDIR_PATTERN = r'<i>(Click <a href="./">here</a> if your browser does not redirect you).</i>' -     +      def decrypt(self, pyfile):          self.passwords = self.getPassword().splitlines() -         +          # API not working anymore -        new_links = self.decryptHTML()                 +        new_links = self.decryptHTML()          if new_links:              self.core.files.addLinks(new_links, self.pyfile.package().id)          else: -            self.fail('Could not extract any links')     +            self.fail('Could not extract any links')      def decryptAPI(self): -             -        get_dict = { "t": "link", "url": self.pyfile.url, "lcache": "1" }  + +        get_dict = { "t": "link", "url": self.pyfile.url, "lcache": "1" }          self.html = self.load('http://linkdecrypter.com/api', get = get_dict)          if self.html.startswith('http://'): return self.html.splitlines() -         +          if self.html == 'INTERRUPTION(PASSWORD)':              for get_dict['pass'] in self.passwords:                  self.html = self.load('http://linkdecrypter.com/api', get= get_dict) -                if self.html.startswith('http://'): return self.html.splitlines()                                                 -         +                if self.html.startswith('http://'): return self.html.splitlines() +          self.logError('API', self.html)          if self.html == 'INTERRUPTION(PASSWORD)':              self.fail("No or incorrect password") -         -        return None                    -             + +        return None +      def decryptHTML(self):          retries = 5 -         -        post_dict = { "link_cache": "on", "pro_links": self.pyfile.url, "modo_links": "text" }                                               -        self.html = self.load('http://linkdecrypter.com/', post = post_dict, cookies = True) -         -        while self.passwords or retries:                                     -            found = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.DOTALL)                     + +        post_dict = { "link_cache": "on", "pro_links": self.pyfile.url, "modo_links": "text" } +        self.html = self.load('http://linkdecrypter.com/', post=post_dict, cookies=True, decode=True) + +        while self.passwords or retries: +            found = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.DOTALL)              if found: return [ x for x in found.group(1).splitlines() if '[LINK-ERROR]' not in x ] -                                              +              found = re.search(self.CAPTCHA_PATTERN, self.html)              if found:                  captcha_url = 'http://linkdecrypter.com/' + found.group(1)                  result_type = "positional" if "getPos" in found.group(2) else "textual" -                 +                  found = re.search(r"<p><i><b>([^<]+)</b></i></p>", self.html)                  msg = found.group(1) if found else ""                  self.logInfo("Captcha protected link", result_type, msg) -                 +                  captcha = self.decryptCaptcha(captcha_url, result_type = result_type)                  if result_type == "positional":                      captcha = "%d|%d" % captcha -                self.html = self.load('http://linkdecrypter.com/', post={ "captcha": captcha }) +                self.html = self.load('http://linkdecrypter.com/', post={ "captcha": captcha }, decode=True)                  retries -= 1 -                 +              elif self.PASSWORD_PATTERN in self.html:                  if self.passwords:                      password = self.passwords.pop(0)                      self.logInfo("Password protected link, trying " + password) -                    self.html = self.load('http://linkdecrypter.com/', post= {'password': password}) +                    self.html = self.load('http://linkdecrypter.com/', post={'password': password}, decode=True)                  else:                      self.fail("No or incorrect password") -             +              else: -                retries -= 1             -                self.html = self.load('http://linkdecrypter.com/', cookies = True) -         -        return None                           
\ No newline at end of file +                retries -= 1 +                self.html = self.load('http://linkdecrypter.com/', cookies=True, decode=True) + +        return None diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index 379b10764..e2ee30731 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -9,12 +9,12 @@ class LixIn(Crypter):      __name__ = "LixIn"      __type__ = "container"      __pattern__ = r"http://(www.)?lix.in/(?P<id>.*)" -    __version__ = "0.21" +    __version__ = "0.22"      __description__ = """Lix.in Container Plugin"""      __author_name__ = ("spoob")      __author_mail__ = ("spoob@pyload.org") -    CAPTCHA_PATTERN='<img src="(?P<image>captcha_img.php\?PHPSESSID=.*?)"' +    CAPTCHA_PATTERN='<img src="(?P<image>captcha_img.php\?.*?)"'      SUBMIT_PATTERN=r"value='continue.*?'"      LINK_PATTERN=r'name="ifram" src="(?P<link>.*?)"' @@ -33,7 +33,7 @@ class LixIn(Crypter):          matches = re.search(self.SUBMIT_PATTERN,self.html)          if not matches: -	    self.fail("link doesn't seem valid") +            self.fail("link doesn't seem valid")          matches = re.search(self.CAPTCHA_PATTERN, self.html)          if matches: @@ -42,20 +42,19 @@ class LixIn(Crypter):                  if matches:                      self.logDebug("trying captcha")                      captcharesult = self.decryptCaptcha("http://lix.in/"+matches.group("image")) -	            self.html = self.req.load(url, decode=True, post={"capt" : captcharesult, "submit":"submit","tiny":id}) -	        else: -	            self.logDebug("no captcha/captcha solved") -	            break -    	else: +                self.html = self.req.load(url, decode=True, post={"capt" : captcharesult, "submit":"submit","tiny":id}) +            else: +                self.logDebug("no captcha/captcha solved") +                break +        else:              self.html = self.req.load(url, decode=True, post={"submit" : "submit", -	                                                      "tiny"   : id}) -	                                      +                                                          "tiny"   : id}) +                                                   matches = re.search(self.LINK_PATTERN, self.html)          if not matches: -	    self.fail("can't find destination url") +            self.fail("can't find destination url")          new_link = matches.group("link")          self.logDebug("Found link %s, adding to package" % new_link)          self.packages.append((self.pyfile.package().name, [new_link], self.pyfile.package().name)) -           
\ No newline at end of file diff --git a/module/plugins/crypter/MegauploadComFolder.py b/module/plugins/crypter/MegauploadComFolder.py deleted file mode 100644 index e18c10758..000000000 --- a/module/plugins/crypter/MegauploadComFolder.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.SimpleCrypter import SimpleCrypter -from re import search -from time import time  - -class MegauploadComFolder(SimpleCrypter): -    __name__ = "MegauploadComFolder" -    __type__ = "crypter" -    __pattern__ = r"http://(?:www\.)?megaupload.com/(?:\?f|xml/folderfiles.php\?folderid)=(\w+)" -    __version__ = "0.01" -    __description__ = """Depositfiles.com Folder Plugin""" -    __author_name__ = ("zoidberg") -    __author_mail__ = ("zoidberg@mujmail.cz") -     -    LINK_PATTERN = r'<ROW[^>]*?url="([^"]+)[^>]*?expired="0"></ROW>' -     -    def init (self): -        folderid = search(self.__pattern__, self.pyfile.url).group(1) -        uniq = time() * 1000 -        self.url = "http://www.megaupload.com/xml/folderfiles.php?folderid=%s&uniq=%d" % (folderid, uniq) - diff --git a/module/plugins/crypter/Movie2kTo.py b/module/plugins/crypter/Movie2kTo.py new file mode 100644 index 000000000..f5800b498 --- /dev/null +++ b/module/plugins/crypter/Movie2kTo.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter +from collections import defaultdict + +class Movie2kTo(Crypter): +	__name__ = 'Movie2kTo' +	__type__ = 'container' +	__pattern__ = r'http://(?:www\.)?movie2k\.to/(.*)\.html' +	__version__ = '0.3' +	__config__ = [('accepted_hosters', 'str', 'List of accepted hosters', 'Xvidstage, '), +				('whole_season', 'bool', 'Download whole season', 'False'), +				('everything', 'bool', 'Download everything', 'False'), +				('firstN', 'int', 'Download the first N files for each episode. The first file is probably all you will need.', '1')] +	__description__ = """Movie2k.to Container Plugin""" +	__author_name__ = ('4Christopher') +	__author_mail__ = ('4Christopher@gmx.de') +	BASE_URL_PATTERN = r'http://(?:www\.)?movie2k\.to/' +	TVSHOW_URL_PATH_PATTERN = r'tvshows-(?P<id>\d+?)-(?P<name>.+)' +	FILM_URL_PATH_PATTERN = r'(?P<name>.+?)-(?:online-film|watch-movie)-(?P<id>\d+)' +	SEASON_PATTERN = r'<div id="episodediv(\d+?)" style="display:(inline|none)">(.*?)</div>' +	EP_PATTERN = r'<option value="(.+?)"( selected)?>Episode\s*?(\d+?)</option>' +	BASE_URL = 'http://www.movie2k.to' + +	def decrypt(self, pyfile): +		self.package = pyfile.package() +		self.folder = self.package.folder +		self.qStatReset() +		whole_season = self.getConfig('whole_season') +		everything = self.getConfig('everything') +		self.getInfo(pyfile.url) + +		if (whole_season or everything) and self.format == 'tvshow': +			self.logDebug('Downloading the whole season') +			for season, season_sel, html in re.findall(self.SEASON_PATTERN, self.html, re.DOTALL | re.I): +				if (season_sel == 'inline') or everything: +					season_links = [] +					for url_path, ep_sel, ep in re.findall(self.EP_PATTERN, html, re.I): +						season_name = self.name_tvshow(season, ep) +						self.logDebug('%s: %s' % (season_name, url_path)) +						if ep_sel and (season_sel == 'inline'): +							self.logDebug('%s selected (in the start URL: %s)' % (season_name, pyfile.url)) +							season_links += self.getInfoAndLinks('%s/%s' % (self.BASE_URL, url_path)) +						elif (whole_season and (season_sel == 'inline')) or everything: +							season_links += self.getInfoAndLinks('%s/%s' % (self.BASE_URL, url_path)) + +					self.logDebug(season_links) +					self.packages.append(('%s: Season %s (%s)' +						% (self.name, season, self.qStat()), season_links, 'Season %s' % season)) +					self.qStatReset() +		else: +			links = self.getLinks() +			self.package.name = '%s%s' % (self.package.name, self.qStat()) +			self.packages.append((self.package.name, links , self.package.folder)) + +	def qStat(self): +		if len(self.q) == 0: return '' +		return (' (Average quality: %d, min: %d, max: %d, %s, max (all hosters): %d)' +			% (sum(self.q) / float(len(self.q)), min(self.q), max(self.q), self.q, self.max_q)) +	def qStatReset(self): +		self.q = [] ## to calculate the average, min and max of the quality +		self.max_q = None +	def tvshow_number(self, number): +		if int(number) < 10: +			return '0%s' % number +		else: +			return number + +	def name_tvshow(self, season, ep): +		return '%s S%sE%s' % (self.name, self.tvshow_number(season), self.tvshow_number(ep)) + +	def getInfo(self, url): +		self.html = self.load(url) +		self.url_path = re.match(self.__pattern__, url).group(1) +		self.format = pattern_re = None +		if re.match(r'tvshows', self.url_path): +			self.format = 'tvshow' +			pattern_re = re.search(self.TVSHOW_URL_PATH_PATTERN, self.url_path) +		elif re.search(self.FILM_URL_PATH_PATTERN, self.url_path): +			self.format = 'film' +			pattern_re = re.search(self.FILM_URL_PATH_PATTERN, self.url_path) + + +		self.name = pattern_re.group('name') +		self.id = pattern_re.group('id') +		self.logDebug('URL Path: %s (ID: %s, Name: %s, Format: %s)' +			% (self.url_path, self.id, self.name, self.format)) + +	def getInfoAndLinks(self, url): +		self.getInfo(url) +		return self.getLinks() + +	## This function returns the links for one episode as list +	def getLinks(self): +		accepted_hosters = re.findall(r'\b(\w+?)\b', self.getConfig('accepted_hosters')) +		firstN = self.getConfig('firstN') +		links = [] +		re_quality = re.compile(r'.+?Quality:.+?smileys/(\d)\.gif') +		## The quality is one digit. 0 is the worst and 5 is the best. +		## Is not always there … +		re_hoster_id_html = re.compile(r'(?:<td height|<tr id).+?<a href=".*?(\d{7}).*?".+? ([^<>]+?)</a>(.+?)</tr>') +		re_hoster_id_js = re.compile(r'links\[(\d+?)\].+ (.+?)</a>(.+?)</tr>') +		## I assume that the ID is 7 digits longs +		count = defaultdict(int) +		matches = re_hoster_id_html.findall(self.html) +		matches += re_hoster_id_js.findall(self.html) +		# self.logDebug(matches) +		## h_id: hoster_id of a possible hoster +		for h_id, hoster, q_html in matches: +			match_q = re_quality.search(q_html) +			if match_q: +				quality = int(match_q.group(1)) +				if self.max_q: +					if self.max_q < quality: self.max_q = quality +				else: ## was None before +					self.max_q = quality +				q_s = ', Quality: %d' % quality +			else: +				q_s = ', unknown quality' +			if hoster in accepted_hosters: +				self.logDebug('Accepted: %s, ID: %s%s' % (hoster, h_id, q_s)) +				count[hoster] += 1 +				if count[hoster] <= firstN: +					if match_q: self.q.append(quality) +					if h_id != self.id: +						self.html = self.load('%s/tvshows-%s-%s.html' % (self.BASE_URL, h_id, self.name)) +					else: +						self.logDebug('This is already the right ID') +					try: +						url = re.search(r'<a target="_blank" href="(http://.*?)"', self.html).group(1) +						self.logDebug('id: %s, %s: %s' % (h_id, hoster, url)) +						links.append(url) +					except: +						self.logDebug('Failed to find the URL') +			else: +				self.logDebug('Not accepted: %s, ID: %s%s' % (hoster, h_id, q_s)) + +		# self.logDebug(links) +		return links diff --git a/module/plugins/crypter/NetfolderIn.py b/module/plugins/crypter/NetfolderIn.py index c8110ef6b..d71a73d0a 100644 --- a/module/plugins/crypter/NetfolderIn.py +++ b/module/plugins/crypter/NetfolderIn.py @@ -7,7 +7,7 @@ class NetfolderIn(Crypter):      __name__ = "NetfolderIn"      __type__ = "crypter"      __pattern__ = r"http://(?:www\.)?netfolder.in/((?P<id1>\w+)/\w+|folder.php\?folder_id=(?P<id2>\w+))" -    __version__ = "0.3" +    __version__ = "0.4"      __description__ = """NetFolder Crypter Plugin"""      __author_name__ = ("RaNaN", "fragonib")      __author_mail__ = ("RaNaN@pyload.org", "fragonib[AT]yahoo[DOT]es") @@ -47,7 +47,7 @@ class NetfolderIn(Crypter):              m = re.match(self.__pattern__, self.pyfile.url)              id = max(m.group('id1'), m.group('id2'))           except AttributeError: -            self.logDebug("Unable to get package id from url [%s]" % url) +            self.logDebug("Unable to get package id from url [%s]" % self.pyfile.url)              return          url = "http://netfolder.in/folder.php?folder_id=" + id          password = self.getPassword() diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index d00e4cc18..8f29a9158 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -5,136 +5,244 @@ from module.plugins.Crypter import Crypter  import base64  import binascii  import re -import urllib +import os +  class RelinkUs(Crypter):      __name__ = "RelinkUs"      __type__ = "crypter"      __pattern__ = r"http://(www\.)?relink.us/(f/|((view|go).php\?id=))(?P<id>.+)" -    __version__ = "2.3" +    __version__ = "3.0"      __description__ = """Relink.us Crypter Plugin"""      __author_name__ = ("fragonib")      __author_mail__ = ("fragonib[AT]yahoo[DOT]es")      # Constants -    _JK_KEY_ = "jk" -    _CRYPTED_KEY_ = "crypted" +    PREFERRED_LINK_SOURCES = ['cnl2', 'dlc', 'web'] + +    OFFLINE_TOKEN = "<title>Tattooside" +    PASSWORD_TOKEN = "container_password.php" +    PASSWORD_ERROR_ROKEN = "You have entered an incorrect password" +    PASSWORD_SUBMIT_URL = "http://www.relink.us/container_password.php" +    CAPTCHA_TOKEN = "container_captcha.php" +    CAPTCHA_ERROR_ROKEN = "You have solved the captcha wrong" +    CAPTCHA_IMG_URL = "http://www.relink.us/core/captcha/circlecaptcha.php" +    CAPTCHA_SUBMIT_URL = "http://www.relink.us/container_captcha.php"  +    FILE_TITLE_REGEX = r"<th>Title</th><td><i>(.*)</i></td></tr>" +    FILE_NOTITLE = 'No title' +         +    CNL2_FORM_REGEX = r'<form id="cnl_form-(.*?)</form>' +    CNL2_FORMINPUT_REGEX = r'<input.*?name="%s".*?value="(.*?)"' +    CNL2_JK_KEY = "jk" +    CNL2_CRYPTED_KEY = "crypted" +    DLC_LINK_REGEX = r'<a href=".*?" class="dlc_button" target="_blank">' +    DLC_DOWNLOAD_URL = "http://www.relink.us/download.php"  +    WEB_FORWARD_REGEX = r"getFile\('(?P<link>.+)'\)"; +    WEB_FORWARD_URL = "http://www.relink.us/frame.php"  +    WEB_LINK_REGEX = r'<iframe name="Container" height="100%" frameborder="no" width="100%" src="(?P<link>.+)"></iframe>' +          def setup(self): +        self.fileid = None +        self.package = None +        self.password = None          self.html = None - +        self.captcha = False +              def decrypt(self, pyfile): +          # Init -        self.pyfile = pyfile -        self.package = pyfile.package() +        self.initPackage(pyfile)          # Request package -        self.html = self.requestPackageInfo() +        self.requestPackage() +         +        # Check for online          if not self.isOnline():              self.offline() -        # Check for password protection     +        # Check for protection              if self.isPasswordProtected(): -            self.html = self.submitPassword() -            if self.html is None: -                self.fail("Incorrect password, please set right password on Edit package form and retry") +            self.unlockPasswordProtection() +            self.handleErrors() +             +        if self.isCaptchaProtected(): +            self.captcha = True +            self.unlockCaptchaProtection() +            self.handleErrors()          # Get package name and folder -        (package_name, folder_name) = self.getPackageNameAndFolder() +        (package_name, folder_name) = self.getPackageInfo() -        # Get package links -        try: -            (crypted, jk) = self.getCipherParams() -            package_links = self.getLinks(crypted, jk) -        except: -            self.fail("Unable to decrypt package") +        # Extract package links +        package_links = [] +        for sources in self.PREFERRED_LINK_SOURCES: +            package_links.extend(self.handleLinkSource(sources)) +            if package_links:  # use only first source which provides links +                break +        package_links = set(package_links)          # Pack -        self.packages = [(package_name, package_links, folder_name)] +        if package_links: +            self.packages = [(package_name, package_links, folder_name)] +        else: +            self.fail('Could not extract any links') + +    def initPackage(self, pyfile): +        self.fileid = re.match(self.__pattern__, pyfile.url).group('id') +        self.package = pyfile.package() +        self.password = self.getPassword() +        self.url = pyfile.url + +    def requestPackage(self): +        self.html = self.load(self.url, decode = True)      def isOnline(self): -        if "sorry.png" in self.html: +        if self.OFFLINE_TOKEN in self.html:              self.logDebug("File not found")              return False          return True      def isPasswordProtected(self): -        if "<h1>Container Protection</h1>" in self.html: +        if self.PASSWORD_TOKEN in self.html:              self.logDebug("Links are password protected")              return True -        return False -     -    def requestPackageInfo(self): -        return self.load(self.pyfile.url) -     -    def submitPassword(self): -        # Gather data -        url = self.pyfile.url -        m = re.match(self.__pattern__, url) -        if m is None: -            self.logDebug("Unable to get package id from url [%s]" % url) -            return -        id = m.group('id') -        password = self.getPassword() -                    -        # Submit package password      -        url = "http://www.relink.us/container_password.php?id=" + id -        post = { '#' : '', 'password' : password, 'pw' : 'submit' } -        self.logDebug("Submitting password [%s] for protected links with id [%s]" % (password, id)) -        html = self.load(url, {}, post) -        # Check for invalid password -        if "An error occurred!" in html: -            self.logDebug("Incorrect password, please set right password on Add package form and retry") -            return None -        else: -            return html    - -    def getPackageNameAndFolder(self): -        # Get title from html -        try: -            title_re = r'<td class="top">Title</td><td class="top">\|</td><td><span class="info_view_id"><i>(?P<title>.+)</i></span></td>' -            title = re.search(title_re, self.html).group('title') -            if 'Title deactived by the owner' in title: -                title = None -        except: -            title = None +    def isCaptchaProtected(self): +        if self.CAPTCHA_TOKEN in self.html: +            self.logDebug("Links are captcha protected") +            return True +        return False -        # Set name & folder -        if title is None: +    def unlockPasswordProtection(self): +        self.logDebug("Submitting password [%s] for protected links" % self.password) +        passwd_url = self.PASSWORD_SUBMIT_URL + "?id=%s" % self.fileid +        passwd_data = { 'id': self.fileid, 'password': self.password, 'pw': 'submit' } +        self.html = self.load(passwd_url, post=passwd_data, decode=True) +             +    def unlockCaptchaProtection(self): +        self.logDebug("Request user positional captcha resolving") +        captcha_img_url = self.CAPTCHA_IMG_URL + "?id=%s" % self.fileid +        coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional') +        self.logDebug("Captcha resolved, coords [%s]" % str(coords)) +        captcha_post_url = self.CAPTCHA_SUBMIT_URL + "?id=%s" % self.fileid +        captcha_post_data = { 'button.x': coords[0], 'button.y': coords[1], 'captcha': 'submit' } +        self.html = self.load(captcha_post_url, post=captcha_post_data, decode=True) + +    def getPackageInfo(self): +        name = folder = None + +        # Try to get info from web         +        m = re.search(self.FILE_TITLE_REGEX, self.html) +        if m is not None: +            title = m.group(1).strip() +            if not self.FILE_NOTITLE in title: +                name = folder = title +                self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) +                 +        # Fallback to defaults +        if not name or not folder:              name = self.package.name              folder = self.package.folder              self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) -        else: -            name = folder = title -            self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) -        return name, folder - -    def getCipherParams(self): +        # Return package info  +        return name, folder  +     +    def handleErrors(self):       +        if self.PASSWORD_ERROR_ROKEN in self.html: +            msg = "Incorrect password, please set right password on 'Edit package' form and retry" +            self.logDebug(msg) +            self.fail(msg)   -        # Get vars dict -        vars = {} -        m = re.search(r'flashVars="(?P<vars>.*)"', self.html) -        text = m.group('vars') -        pairs = text.split('&') -        for pair in pairs: -            index = pair.index('=') -            vars[pair[:index]] = pair[index + 1:] +        if self.captcha:           +            if self.CAPTCHA_ERROR_ROKEN in self.html: +                self.logDebug("Invalid captcha, retrying") +                self.invalidCaptcha() +                self.retry() +            else: +                self.correctCaptcha() +            +    def handleLinkSource(self, source): +        if source == 'cnl2': +            return self.handleCNL2Links() +        elif source == 'dlc': +            return self.handleDLCLinks() +        elif source == 'web': +            return self.handleWEBLinks() +        else: +            self.fail('Unknown source [%s] (this is probably a bug)' % source) +             +    def handleCNL2Links(self): +        self.logDebug("Search for CNL2 links") +        package_links = [] +        m = re.search(self.CNL2_FORM_REGEX, self.html, re.DOTALL) +        if m is not None: +            cnl2_form = m.group(1) +            try: +                (vcrypted, vjk) = self._getCipherParams(cnl2_form) +                for (crypted, jk) in zip(vcrypted, vjk): +                    package_links.extend(self._getLinks(crypted, jk)) +            except: +                self.logDebug("Unable to decrypt CNL2 links") +        return package_links +     +    def handleDLCLinks(self): +        self.logDebug('Search for DLC links') +        package_links = [] +        m = re.search(self.DLC_LINK_REGEX, self.html) +        if m is not None: +            container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid  +            self.logDebug("Downloading DLC container link [%s]" % container_url) +            try: +                dlc = self.load(container_url) +                dlc_filename = self.fileid + ".dlc" +                dlc_filepath = os.path.join(self.config["general"]["download_folder"], dlc_filename) +                f = open(dlc_filepath, "wb") +                f.write(dlc) +                f.close() +                package_links.append(dlc_filepath) +            except: +                self.logDebug("Unable to download DLC container")     +        return package_links -        # Extract cipher pair -        jk = urllib.unquote(vars[RelinkUs._JK_KEY_].replace("+", " ")) -        crypted = vars[RelinkUs._CRYPTED_KEY_] +    def handleWEBLinks(self): +        self.logDebug("Search for WEB links") +        package_links = [] +        fw_params = re.findall(self.WEB_FORWARD_REGEX, self.html) +        self.logDebug("Decrypting %d Web links" % len(fw_params)) +        for index, fw_param in enumerate(fw_params): +            try: +                fw_url = self.WEB_FORWARD_URL + "?%s" % fw_param +                self.logDebug("Decrypting Web link %d, %s" % (index+1, fw_url)) +                fw_response = self.load(fw_url, decode=True) +                dl_link = re.search(self.WEB_LINK_REGEX, fw_response).group('link') +                package_links.append(dl_link) +            except Exception, detail: +                self.logDebug("Error decrypting Web link %s, %s" % (index, detail)) +            self.setWait(4) +            self.wait() +        return package_links +     +    def _getCipherParams(self, cnl2_form): +             +        # Get jk +        jk_re = self.CNL2_FORMINPUT_REGEX % self.CNL2_JK_KEY        +        vjk = re.findall(jk_re, cnl2_form, re.IGNORECASE) +         +        # Get crypted +        crypted_re = self.CNL2_FORMINPUT_REGEX % RelinkUs.CNL2_CRYPTED_KEY        +        vcrypted = re.findall(crypted_re, cnl2_form, re.IGNORECASE)          # Log and return -        self.logDebug("Javascript cipher key function [%s]" % jk) -        return crypted, jk +        self.logDebug("Detected %d crypted blocks" % len(vcrypted)) +        return vcrypted, vjk -    def getLinks(self, crypted, jk): +    def _getLinks(self, crypted, jk):          # Get key          jreturn = self.js.eval("%s f()" % jk) -        self.logDebug("JsEngine returns value key=[%s]" % jreturn) +        self.logDebug("JsEngine returns value [%s]" % jreturn)          key = binascii.unhexlify(jreturn)          # Decode crypted diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 0df26110e..1ffa5d41a 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -12,7 +12,7 @@ class ShareLinksBiz(Crypter):      __name__ = "ShareLinksBiz"
      __type__ = "crypter"
      __pattern__ = r"(?P<base>http://[\w\.]*?(share-links|s2l)\.biz)/(?P<id>_?[0-9a-z]+)(/.*)?"
 -    __version__ = "1.1"
 +    __version__ = "1.12"
      __description__ = """Share-Links.biz Crypter"""
      __author_name__ = ("fragonib")
      __author_mail__ = ("fragonib[AT]yahoo[DOT]es")
 @@ -32,7 +32,7 @@ class ShareLinksBiz(Crypter):          # Request package
          url = self.baseUrl + '/' + self.fileId
 -        self.html = self.load(url)
 +        self.html = self.load(url, decode=True)
          # Unblock server (load all images)
          self.unblockServer()
 @@ -96,7 +96,7 @@ class ShareLinksBiz(Crypter):          self.logDebug("Submitting password [%s] for protected links" % password)
          post = {"password": password, 'login': 'Submit form'}
          url = self.baseUrl + '/' + self.fileId
 -        self.html = self.load(url, post=post)
 +        self.html = self.load(url, post=post, decode=True)
      def unlockCaptchaProtection(self):
          # Get captcha map
 @@ -119,7 +119,7 @@ class ShareLinksBiz(Crypter):              self.wait()
              self.retry()
          url = self.baseUrl + href
 -        self.html = self.load(url)
 +        self.html = self.load(url, decode=True)
      def _getCaptchaMap(self):
          map = {}
 @@ -152,16 +152,24 @@ class ShareLinksBiz(Crypter):                  self.correctCaptcha() 
      def getPackageInfo(self):
 +        name = folder = None
 +        
 +        # Extract from web package header
          title_re = r'<h2><img.*?/>(.*)</h2>'
          m = re.search(title_re, self.html, re.DOTALL)
          if m is not None:
              title = m.group(1).strip()
 -            name = folder = title
 -            self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder))
 -        else:
 +            if 'unnamed' not in title:
 +                name = folder = title
 +                self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder))
 +                
 +        # Fallback to defaults
 +        if not name or not folder:
              name = self.package.name
              folder = self.package.folder
              self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
 +            
 +        # Return package info 
          return name, folder 
      def handleWebLinks(self):
 diff --git a/module/plugins/crypter/SpeedLoadOrgFolder.py b/module/plugins/crypter/SpeedLoadOrgFolder.py new file mode 100644 index 000000000..5b350787f --- /dev/null +++ b/module/plugins/crypter/SpeedLoadOrgFolder.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + +class SpeedLoadOrgFolder(SimpleCrypter): +    __name__ = "SpeedLoadOrgFolder" +    __type__ = "crypter" +    __pattern__ = r"http://(www\.)?speedload\.org/(\d+~f$|folder/\d+/)" +    __version__ = "0.2" +    __description__ = """Speedload Crypter Plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    LINK_PATTERN = r'<div class="link"><a href="(http://speedload.org/\w+)"' +    TITLE_PATTERN = r'<title>Files of: (?P<title>[^<]+) folder</title>' diff --git a/module/plugins/crypter/TrailerzoneInfo.py b/module/plugins/crypter/TrailerzoneInfo.py index 2683c2429..43a4fcce5 100644 --- a/module/plugins/crypter/TrailerzoneInfo.py +++ b/module/plugins/crypter/TrailerzoneInfo.py @@ -22,10 +22,10 @@ class TrailerzoneInfo(Crypter):              self.handleProtect(url)          elif goPattern.match(url):              self.handleGo(url) -			 +      def handleProtect(self, url):          self.handleGo("http://trailerzone.info/go.html#:::" + url.split("#:::",1)[1]) -			 +      def handleGo(self, url):          src = self.req.load(str(url)) diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py new file mode 100644 index 000000000..d4534297e --- /dev/null +++ b/module/plugins/crypter/UploadedToFolder.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*-
 +
 +from module.plugins.Crypter import Crypter
 +import re
 +
 +class UploadedToFolder(Crypter):
 +    __name__ = "UploadedToFolder"
 +    __type__ = "crypter"
 +    __pattern__ = r"http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|list)/(?P<id>\w+)"
 +    __version__ = "0.1"
 +    __description__ = """UploadedTo Crypter Plugin"""
 +    __author_name__ = ("stickell")
 +    __author_mail__ = ("l.stickell@yahoo.it")
 +
 +    PLAIN_PATTERN = r'<small class="date"><a href="(?P<plain>[\w/]+)" onclick='
 +    TITLE_PATTERN = r'<title>(?P<title>[^<]+)</title>'
 +
 +    def decrypt(self, pyfile):
 +        self.html = self.load(pyfile.url)
 +
 +        package_name, folder_name = self.getPackageNameAndFolder()
 +
 +        m = re.search(self.PLAIN_PATTERN, self.html)
 +        if m:
 +            plain_link = 'http://uploaded.net/' + m.group('plain')
 +        else:
 +            self.fail('Parse error - Unable to find plain url list')
 +
 +        self.html = self.load(plain_link)
 +        package_links = self.html.split('\n')[:-1]
 +        self.logDebug('Package has %d links' % len(package_links))
 +
 +        self.packages = [(package_name, package_links, folder_name)]
 +
 +    def getPackageNameAndFolder(self):
 +        m = re.search(self.TITLE_PATTERN, self.html)
 +        if m:
 +            name = folder = m.group('title')
 +            self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder))
 +            return name, folder
 +        else:
 +            name = self.pyfile.package().name
 +            folder = self.pyfile.package().folder
 +            self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
 +            return name, folder
 diff --git a/module/plugins/crypter/YoutubeBatch.py b/module/plugins/crypter/YoutubeBatch.py index b48026654..2e68dfe02 100644 --- a/module/plugins/crypter/YoutubeBatch.py +++ b/module/plugins/crypter/YoutubeBatch.py @@ -8,26 +8,19 @@ from module.plugins.Crypter import Crypter  class YoutubeBatch(Crypter):      __name__ = "YoutubeBatch"      __type__ = "container" -    __pattern__ = r"http://(?:www\.)?(?:de\.)?\youtube\.com/(?:user/.*?/user/(?P<g1>.{16})|(?:.*?feature=PlayList\&|view_play_list\?)p=(?P<g2>.{16}))" -    __version__ = "0.9" +    __pattern__ = r"http://(?:[^/]*?)youtube\.com/((?:view_play_list|playlist|.*?feature=PlayList).*?[\?&](?:list|p)=|user/)(\w+)" +    __version__ = "0.92"      __description__ = """Youtube.com Channel Download Plugin""" -    __author_name__ = ("RaNaN", "Spoob") -    __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") - -    def setup(self): -        compile_id = re.compile(self.__pattern__) -        match_id = compile_id.match(self.pyfile.url) -        self.playlist = match_id.group(match_id.lastgroup) - -    def file_exists(self): -        if "User not found" in self.req.load("http://gdata.youtube.com/feeds/api/playlists/%s?v=2" % self.playlist): -            return False -        return True +    __author_name__ = ("RaNaN", "Spoob", "zoidberg") +    __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "zoidberg@mujmail.cz")      def decrypt(self, pyfile): -        if not self.file_exists(): -            self.offline() -        url = "http://gdata.youtube.com/feeds/api/playlists/%s?v=2" % self.playlist            +        match_id = re.match(self.__pattern__, self.pyfile.url) +        if match_id.group(1) == "user/": +            url = "http://gdata.youtube.com/feeds/api/users/%s/uploads?v=2" % match_id.group(2) +        else: +            url = "http://gdata.youtube.com/feeds/api/playlists/%s?v=2" % match_id.group(2) +          rep = self.load(url)          new_links = []          new_links.extend(re.findall(r"href\='(http:\/\/www.youtube.com\/watch\?v\=[^']+)&", rep)) diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py new file mode 100755 index 000000000..a01ce9576 --- /dev/null +++ b/module/plugins/hooks/Captcha9kw.py @@ -0,0 +1,153 @@ +# -*- 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: mkaay, RaNaN, zoidberg
 +"""
 +from __future__ import with_statement
 +
 +from thread import start_new_thread
 +from base64 import b64encode
 +import cStringIO
 +import pycurl
 +import time
 +
 +from module.network.RequestFactory import getURL, getRequest
 +from module.network.HTTPRequest import BadHeader
 +
 +from module.plugins.Hook import Hook
 +
 +class Captcha9kw(Hook):
 +    __name__ = "Captcha9kw"
 +    __version__ = "0.03"
 +    __description__ = """send captchas to 9kw.eu"""
 +    __config__ = [("activated", "bool", "Activated", True),
 +                  ("force", "bool", "Force CT even if client is connected", True),
 +                  ("passkey", "password", "API key", ""),]
 +    __author_name__ = ("RaNaN")
 +    __author_mail__ = ("RaNaN@pyload.org")
 +
 +    API_URL = "http://www.9kw.eu/index.cgi"
 +
 +    def setup(self):
 +        self.info = {}
 +
 +    def getCredits(self):
 +        response = getURL(self.API_URL, get = { "apikey": self.getConfig("passkey"), "pyload": "1", "source": "pyload", "action": "usercaptchaguthaben" })
 +
 +        if response.isdigit():
 +            self.logInfo(_("%s credits left") % response)
 +            self.info["credits"] = credits = int(response)
 +            return credits
 +        else:
 +            self.logError(response)
 +            return 0
 +
 +    def processCaptcha(self, task):
 +        result = None
 +
 +        with open(task.captchaFile, 'rb') as f:
 +            data = f.read()
 +        data = b64encode(data)
 +        self.logDebug("%s : %s" % (task.captchaFile, data))
 +        if task.isPositional():
 +            mouse = 1
 +        else:
 +            mouse = 0
 +
 +        response = getURL(self.API_URL, post = { 
 +                          "apikey": self.getConfig("passkey"), 
 +                          "pyload": "1", 
 +                          "source": "pyload", 
 +                          "base64": "1", 
 +                          "mouse": mouse,
 +                          "file-upload-01": data, 
 +                          "action": "usercaptchaupload" })
 +
 +        if response.isdigit():
 +            self.logInfo(_("NewCaptchaID from upload: %s : %s" % (response,task.captchaFile)))
 +
 +            for i in range(1, 200, 2): 
 +                response2 = getURL(self.API_URL, get = { "apikey": self.getConfig("passkey"), "id": response,"pyload": "1","source": "pyload", "action": "usercaptchacorrectdata" })
 +
 +                if(response2 != ""):
 +                    break;
 +
 +                time.sleep(1)
 +
 +            result = response2
 +            task.data["ticket"] = response
 +            self.logInfo("result %s : %s" % (response, result))
 +            task.setResult(result)
 +        else:
 +            self.logError("Bad upload: %s" % response)
 +            return False
 +
 +    def newCaptchaTask(self, task):
 +        if not task.isTextual() and not task.isPositional():
 +            return False
 +
 +        if not self.getConfig("passkey"):
 +            return False
 +
 +        if self.core.isClientConnected() and not self.getConfig("force"):
 +            return False
 +
 +        if self.getCredits() > 0:
 +            task.handler.append(self)
 +            task.setWaiting(220)
 +            start_new_thread(self.processCaptcha, (task,))
 +
 +        else:
 +            self.logError(_("Your Captcha 9kw.eu Account has not enough credits"))
 +
 +    def captchaCorrect(self, task):
 +        if "ticket" in task.data:
 +
 +            try:
 +                response = getURL(self.API_URL, 
 +                              post={ "action": "usercaptchacorrectback",
 +                                     "apikey": self.getConfig("passkey"),
 +                                     "api_key": self.getConfig("passkey"),
 +                                     "correct": "1",
 +                                     "pyload": "1",
 +                                     "source": "pyload", 
 +                                     "id": task.data["ticket"] }
 +                              )
 +                self.logInfo("Request correct: %s" % response)
 +
 +            except BadHeader, e:
 +                self.logError("Could not send correct request.", str(e))
 +        else:
 +             self.logError("No CaptchaID for correct request (task %s) found." % task)
 +
 +    def captchaInvalid(self, task):
 +        if "ticket" in task.data:
 +            
 +            try:
 +                response = getURL(self.API_URL, 
 +                              post={ "action": "usercaptchacorrectback",
 +                                     "apikey": self.getConfig("passkey"),
 +                                     "api_key": self.getConfig("passkey"),
 +                                     "correct": "2",
 +                                     "pyload": "1",
 +                                     "source": "pyload", 
 +                                     "id": task.data["ticket"] }
 +                              )
 +                self.logInfo("Request refund: %s" % response)
 +
 +            except BadHeader, e:
 +                self.logError("Could not send refund request.", str(e))
 +        else:
 +            self.logError("No CaptchaID for not correct request (task %s) found." % task)
 diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py new file mode 100644 index 000000000..8cd997f4d --- /dev/null +++ b/module/plugins/hooks/DebridItaliaCom.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHoster import MultiHoster + + +class DebridItaliaCom(MultiHoster): +    __name__ = "DebridItaliaCom" +    __version__ = "0.01" +    __type__ = "hook" +    __config__ = [("activated", "bool", "Activated", "False"), +                  ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), +                  ("hosterList", "str", "Hoster list (comma separated)", ""), +                  ("unloadFailing", "bool", "Revert to standard download if download fails", "False"), +                  ("interval", "int", "Reload interval in hours (0 to disable)", "24")] + +    __description__ = """Debriditalia.com hook plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    def getHoster(self): +        return ["netload.in", "hotfile.com", "rapidshare.com", "multiupload.com", +                "uploading.com", "megashares.com", "crocko.com", "filepost.com", +                "bitshare.com", "share-links.biz", "putlocker.com", "uploaded.to", +                "speedload.org", "rapidgator.net", "likeupload.net", "cyberlocker.ch", +                "depositfiles.com", "extabit.com", "filefactory.com", "sharefiles.co"] diff --git a/module/plugins/hooks/ReloadCc.py b/module/plugins/hooks/ReloadCc.py new file mode 100644 index 000000000..dbd9d659b --- /dev/null +++ b/module/plugins/hooks/ReloadCc.py @@ -0,0 +1,65 @@ +from module.plugins.internal.MultiHoster import MultiHoster + +from module.common.json_layer      import json_loads +from module.network.RequestFactory import getURL + +class ReloadCc(MultiHoster): +    __name__ = "ReloadCc" +    __version__ = "0.3" +    __type__ = "hook" +    __description__ = """Reload.cc hook plugin""" + +    __config__ = [("activated", "bool", "Activated", "False"), +                  ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), +                  ("hosterList", "str", "Hoster list (comma separated)", "")] + +    __author_name__ = ("Reload Team") +    __author_mail__ = ("hello@reload.cc") + +    interval = 0 # Disable periodic calls + +    def getHoster(self): +        # If no accounts are available there will be no hosters available +        if not self.account or not self.account.canUse(): +            print "ReloadCc: No accounts available" +            return [] + +        # Get account data +        (user, data) = self.account.selectAccount() + +        # Get supported hosters list from reload.cc using the json API v1 +        query_params = dict( +            via='pyload', +            v=1, +            get_supported='true', +            get_traffic='true', +            user=user +        ) + +        try: +            query_params.update(dict(hash=self.account.infos[user]['pwdhash'])) +        except Exception: +            query_params.update(dict(pwd=data['password'])) + +        answer = getURL("http://api.reload.cc/login", get=query_params) +        data = json_loads(answer) + + +        # If account is not valid thera are no hosters available +        if data['status'] != "ok": +            print "ReloadCc: Status is not ok: %s" % data['status'] +            return [] + +        # Extract hosters from json file +        return data['msg']['supportedHosters'] + +    def coreReady(self): +        # Get account plugin and check if there is a valid account available +        self.account = self.core.accountManager.getAccountPlugin("ReloadCc") +        if not self.account.canUse(): +            self.account = None +            self.logError("Please add a valid reload.cc account first and restart pyLoad.") +            return + +        # Run the overwriten core ready which actually enables the multihoster hook +        return MultiHoster.coreReady(self) diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index e93e7beb9..fe58ff0a7 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -13,7 +13,7 @@ from module.utils import parseFileSize, fs_encode  class AlldebridCom(Hoster):
      __name__ = "AlldebridCom"
 -    __version__ = "0.2"
 +    __version__ = "0.3"
      __type__ = "hoster"
      __pattern__ = r"https?://.*alldebrid\..*"
 @@ -57,7 +57,7 @@ class AlldebridCom(Hoster):              if data["error"]:
                  if data["error"] == "This link isn't available on the hoster website.":
 -                   self.offline()
 +                    self.offline()
                  else:
                      self.logWarning(data["error"])
                      self.tempOffline()
 diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 140d0b136..7070fafde 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -12,10 +12,10 @@ class BasePlugin(Hoster):      __name__ = "BasePlugin"      __type__ = "hoster"      __pattern__ = r"^unmatchable$" -    __version__ = "0.151" +    __version__ = "0.17"      __description__ = """Base Plugin when any other didnt fit""" -    __author_name__ = ("RaNaN", 'hagg') -    __author_mail__ = ("RaNaN@pyload.org", '') +    __author_name__ = ("RaNaN") +    __author_mail__ = ("RaNaN@pyload.org")      def setup(self):          self.chunkLimit = -1 @@ -47,14 +47,22 @@ class BasePlugin(Hoster):                  if e.code in (401, 403):                      self.logDebug("Auth required") -                    pwd = pyfile.package().password.strip() -                    if ":" not in pwd: -                        self.fail(_("Authorization required (username:password)")) +                    account = self.core.accountManager.getAccountPlugin('Http') +                    servers = [ x['login'] for x in account.getAllAccounts() ] +                    server = urlparse(pyfile.url).netloc + +                    if server in servers: +                        self.logDebug("Logging on to %s" % server) +                        self.req.addAuth(account.accounts[server]["password"]) +                    else: +                        for pwd in pyfile.package().password.splitlines(): +                            if ":" in pwd: +                                self.req.addAuth(pwd.strip()) +                                break +                        else: +                            self.fail(_("Authorization required (username:password)")) -                    self.req.addAuth(pwd)                      self.downloadFile(pyfile) -                elif e.code == 404: -                    self.offline()                  else:                      raise @@ -63,18 +71,20 @@ class BasePlugin(Hoster):      def downloadFile(self, pyfile): -        header = self.load(pyfile.url, just_header = True) -        #self.logDebug(header) +        url = pyfile.url -        # self.load does not raise a BadHeader on 404 responses, do it here -        if header.has_key('code') and header['code'] == 404: -            raise BadHeader(404) +        for i in range(5): +            header = self.load(url, just_header = True) -        if 'location' in header: -            self.logDebug("Location: " + header['location']) -            url = unquote(header['location']) -        else: -            url = pyfile.url +            # self.load does not raise a BadHeader on 404 responses, do it here +            if header.has_key('code') and header['code'] == 404: +                raise BadHeader(404) + +            if 'location' in header: +                self.logDebug("Location: " + header['location']) +                url = unquote(header['location']) +            else: +                break          name = html_unescape(unquote(urlparse(url).path.split("/")[-1])) diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index a0717ad64..49299d463 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- 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 @@ -23,7 +23,7 @@ class BezvadataCz(SimpleHoster):      __name__ = "BezvadataCz"      __type__ = "hoster"      __pattern__ = r"http://(\w*\.)*bezvadata.cz/stahnout/.*" -    __version__ = "0.23" +    __version__ = "0.24"      __description__ = """BezvaData.cz"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -31,15 +31,64 @@ class BezvadataCz(SimpleHoster):      FILE_NAME_PATTERN = r'<p><b>Soubor: (?P<N>[^<]+)</b></p>'      FILE_SIZE_PATTERN = r'<li><strong>Velikost:</strong> (?P<S>[^<]+)</li>'      FILE_OFFLINE_PATTERN = r'<title>BezvaData \| Soubor nenalezen</title>' -    DOWNLOAD_FORM_PATTERN = r'<form class="download" action="([^"]+)" method="post" id="frm-stahnoutForm">' + +    def setup(self): +        self.multiDL = self.resumeDownload = True      def handleFree(self): -        found = re.search(self.DOWNLOAD_FORM_PATTERN, self.html) -        if found is None: self.parseError("Download form") -        url = "http://bezvadata.cz" + found.group(1) -        self.logDebug("Download form: %s" % url)        -               -        self.download(url, post = {"stahnoutSoubor": "St%C3%A1hnout"}, cookies = True) +        #download button +        found = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) +        if not found: self.parseError("page1 URL") +        url = "http://bezvadata.cz%s" % found.group(1) + +        #captcha form +        self.html = self.load(url) +        self.checkErrors() +        for i in range(5): +            action, inputs = self.parseHtmlForm('frm-stahnoutFreeForm') +            if not inputs: self.parseError("FreeForm") + +            found = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html) +            if not found: self.parseError("captcha img") + +            #captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url +            self.load, proper_load = self.loadcaptcha, self.load +            try: +                inputs['captcha'] = self.decryptCaptcha(found.group(1), imgtype='png') +            finally: +                self.load = proper_load + +            if '<img src="data:image/png;base64' in self.html: +                self.invalidCaptcha() +            else: +                self.correctCaptcha() +                break +        else: +            self.fail("No valid captcha code entered") + +        #download url +        self.html = self.load("http://bezvadata.cz%s" % action, post=inputs) +        self.checkErrors() +        found = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html) +        if not found: self.parseError("page2 URL") +        url = "http://bezvadata.cz%s" % found.group(1) +        self.logDebug("DL URL %s" % url) + +        #countdown +        found = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html) +        wait_time = (int(found.group(1)) * 60 + int(found.group(2)) + 1) if found else 120 +        self.setWait(wait_time, False) +        self.wait() + +        self.download(url) + +    def checkErrors(self): +        if 'images/button-download-disable.png' in self.html: +            self.longWait(300, 24) #parallel dl limit +        elif '<div class="infobox' in self.html: +            self.tempOffline() + +    def loadcaptcha(self, data, *args, **kwargs): +        return data.decode("base64")  getInfo = create_getInfo(BezvadataCz) -        
\ No newline at end of file diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py new file mode 100644 index 000000000..5b053d547 --- /dev/null +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class BillionuploadsCom(XFileSharingPro): +    __name__ = "BillionuploadsCom" +    __type__ = "hoster" +    __pattern__ = r"http://(?:\w*\.)*?billionuploads.com/\w{12}" +    __version__ = "0.01" +    __description__ = """billionuploads.com hoster plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") + +    FILE_NAME_PATTERN = r'<b>Filename:</b>(?P<N>.*?)<br>' +    FILE_SIZE_PATTERN = r'<b>Size:</b>(?P<S>.*?)<br>' +    HOSTER_NAME = "billionuploads.com" + +getInfo = create_getInfo(BillionuploadsCom) diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index f5d59d428..644345387 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -46,7 +46,7 @@ class BitshareCom(Hoster):      __name__ = "BitshareCom"      __type__ = "hoster"      __pattern__ = r"http://(www\.)?bitshare\.com/(files/(?P<id1>[a-zA-Z0-9]+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>[a-zA-Z0-9]+))" -    __version__ = "0.45" +    __version__ = "0.47"      __description__ = """Bitshare.Com File Download Hoster"""      __author_name__ = ("paulking", "fragonib")      __author_mail__ = (None, "fragonib[AT]yahoo[DOT]es") @@ -55,8 +55,9 @@ class BitshareCom(Hoster):      FILE_OFFLINE_PATTERN = r'''(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'''      FILE_INFO_PATTERN = r'<h1>(Downloading|Streaming)\s(?P<name>.+?)\s-\s(?P<size>[\d.]+)\s(?P<units>..)yte</h1>'      FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' -    CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) "  -         +    CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) " +    TRAFFIC_USED_UP = r"Your Traffic is used up for today. Upgrade to premium to continue!" +      def setup(self):          self.multiDL = self.premium          self.chunkLimit = 1 @@ -74,12 +75,21 @@ class BitshareCom(Hoster):          # Load main page          self.req.cj.setCookie(self.HOSTER_DOMAIN, "language_selection", "EN") -        self.html = self.load(self.pyfile.url, ref=False, decode=True, cookies = False) +        self.html = self.load(self.pyfile.url, ref=False, decode=True)          # Check offline          if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None:              self.offline() -            + +        # Check Traffic used up +        if re.search(BitshareCom.TRAFFIC_USED_UP, self.html) is not None: +            self.logInfo("Your Traffic is used up for today. Wait 1800 seconds or reconnect!") +            self.logDebug("Waiting %d seconds." % 1800) +            self.setWait(1800, True) +            self.wantReconnect = True +            self.wait() +            self.retry() +          # File name          m = re.search(BitshareCom.__pattern__, self.pyfile.url)          name1 = m.group('name') if m is not None else None @@ -124,8 +134,8 @@ class BitshareCom(Hoster):              else:                  self.setWait(wait - 55, True)                  self.wait() -                self.retry()   -             +                self.retry() +          # Resolve captcha          if captcha == 1:              self.logDebug("File is captcha protected") diff --git a/module/plugins/hoster/BoltsharingCom.py b/module/plugins/hoster/BoltsharingCom.py new file mode 100644 index 000000000..2f42c8b23 --- /dev/null +++ b/module/plugins/hoster/BoltsharingCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class BoltsharingCom(XFileSharingPro): +    __name__ = "BoltsharingCom" +    __type__ = "hoster" +    __pattern__ = r"http://(?:\w*\.)*?boltsharing.com/\w{12}" +    __version__ = "0.01" +    __description__ = """Boltsharing.com hoster plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") + +    HOSTER_NAME = "boltsharing.com" + +getInfo = create_getInfo(BoltsharingCom) diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py new file mode 100644 index 000000000..47063096e --- /dev/null +++ b/module/plugins/hoster/CatShareNet.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import re +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.ReCaptcha import ReCaptcha + + +class CatShareNet(SimpleHoster): +    __name__ = "CatShareNet" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?catshare.net/\w{16}.*" +    __version__ = "0.01" +    __description__ = """CatShare.net Download Hoster""" +    __author_name__ = ("z00nx") +    __author_mail__ = ("z00nx0@gmail.com") + +    FILE_INFO_PATTERN = r'<h3 class="pull-left"[^>]+>(?P<N>.*)</h3>\s+<h3 class="pull-right"[^>]+>(?P<S>.*)</h3>' +    FILE_OFFLINE_PATTERN = r'Podany plik zosta' +    SECONDS_PATTERN = 'var\s+count\s+=\s+(\d+);' +    RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy" + +    def handleFree(self): +        found = re.search(self.SECONDS_PATTERN, self.html) +        seconds = int(found.group(1)) +        self.logDebug("Seconds found", seconds) +        self.setWait(seconds + 1) +        self.wait() +        recaptcha = ReCaptcha(self) +        challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY) +        post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": code} +        self.download(self.pyfile.url, post=post_data) +        check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")}) +        if check == "html": +            self.logDebug("Wrong captcha entered") +            self.invalidCaptcha() +            self.retry() + +getInfo = create_getInfo(CatShareNet) diff --git a/module/plugins/hoster/ChipDe.py b/module/plugins/hoster/ChipDe.py new file mode 100644 index 000000000..fcb84a300 --- /dev/null +++ b/module/plugins/hoster/ChipDe.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter + +class ChipDe(Crypter): +	__name__ = "ChipDe" +	__type__ = "container" +	__pattern__ = r"http://(?:www\.)?chip.de/video/.*\.html" +	__version__ = "0.1" +	__description__ = """Chip.de Container Plugin""" +	__author_name__ = ('4Christopher') +	__author_mail__ = ('4Christopher@gmx.de') + +	def decrypt(self, pyfile): +		self.html = self.load(pyfile.url) +		try: +			url = re.search(r'"(http://video.chip.de/\d+?/.*)"', self.html).group(1) +			self.logDebug('The file URL is %s' % url) +		except: +			self.fail('Failed to find the URL') + +		self.packages.append((self.pyfile.package().name, [ url ], self.pyfile.package().folder)) diff --git a/module/plugins/hoster/CloudzerNet.py b/module/plugins/hoster/CloudzerNet.py new file mode 100644 index 000000000..08a54d509 --- /dev/null +++ b/module/plugins/hoster/CloudzerNet.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +import re +from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo +from module.common.json_layer import json_loads +from module.plugins.ReCaptcha import ReCaptcha +from module.network.RequestFactory import getURL + + +def getInfo(urls): +    for url in urls: +        header = getURL(url, just_header=True) +        if 'Location: http://cloudzer.net/404' in header: +            file_info = (url, 0, 1, url) +        else: +            file_info = parseFileInfo(CloudzerNet, url, getURL(url, decode=True)) +        yield file_info + + +class CloudzerNet(SimpleHoster): +    __name__ = "CloudzerNet" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?(cloudzer\.net/file/|clz\.to/(file/)?)(?P<ID>\w+).*" +    __version__ = "0.01" +    __description__ = """Cloudzer.net hoster plugin""" +    __author_name__ = ("gs", "z00nx") +    __author_mail__ = ("I-_-I-_-I@web.de", "z00nx0@gmail.com") + +    FILE_SIZE_PATTERN = '<span class="size">(?P<S>[^<]+)</span>' +    WAIT_PATTERN = '<meta name="wait" content="(\d+)">' +    FILE_OFFLINE_PATTERN = r'Please check the URL for typing errors, respectively' +    CAPTCHA_KEY = '6Lcqz78SAAAAAPgsTYF3UlGf2QFQCNuPMenuyHF3' + +    def handleFree(self): +        found = re.search(self.WAIT_PATTERN, self.html) +        seconds = int(found.group(1)) +        self.logDebug("Found wait", seconds) +        self.setWait(seconds + 1) +        self.wait() +        response = self.load('http://cloudzer.net/io/ticket/slot/%s' % self.file_info['ID'], post=' ', cookies=True) +        self.logDebug("Download slot request response", response) +        response = json_loads(response) +        if response["succ"] is not True: +            self.fail("Unable to get a download slot") + +        recaptcha = ReCaptcha(self) +        challenge, response = recaptcha.challenge(self.CAPTCHA_KEY) +        post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response} +        response = json_loads(self.load('http://cloudzer.net/io/ticket/captcha/%s' % self.file_info['ID'], post=post_data, cookies=True)) +        self.logDebug("Captcha check response", response) +        self.logDebug("First check") + +        if "err" in response: +            if response["err"] == "captcha": +                self.logDebug("Wrong captcha") +                self.invalidCaptcha() +                self.retry() +            elif "Sie haben die max" in response["err"] or "You have reached the max" in response["err"]: +                self.logDebug("Download limit reached, waiting an hour") +                self.setWait(3600) +                self.wait() +        if "type" in response: +            if response["type"] == "download": +                url = response["url"] +                self.logDebug("Download link", url) +                self.download(url, disposition=True) diff --git a/module/plugins/hoster/CoolshareCz.py b/module/plugins/hoster/CoolshareCz.py deleted file mode 100644 index 7007b6fcb..000000000 --- a/module/plugins/hoster/CoolshareCz.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- 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 -""" - -#shares code with WarserverCz - -import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.network.HTTPRequest import BadHeader -from module.utils import html_unescape - -class CoolshareCz(SimpleHoster): -    __name__ = "CoolshareCz" -    __type__ = "hoster" -    __pattern__ = r"http://(?:\w*\.)?coolshare.cz/stahnout/(?P<ID>\d+)/.+" -    __version__ = "0.12" -    __description__ = """CoolShare.cz""" -    __author_name__ = ("zoidberg") - -    FILE_NAME_PATTERN = ur'<h1.*?>Stáhnout (?P<N>[^<]+)</h1>' -    FILE_SIZE_PATTERN = r'<li>Velikost: <strong>(?P<S>[^<]+)</strong>' -    FILE_OFFLINE_PATTERN = r'<h1>Soubor nenalezen</h1>' -     -    PREMIUM_URL_PATTERN = r'href="(http://[^/]+/dwn-premium.php.*?)"' -    DOMAIN = "http://csd01.coolshare.cz" -     -    SH_CHECK_TRAFFIC = True              -               -    def handleFree(self): -        try:       -            self.download("%s/dwn-free.php?fid=%s" % (self.DOMAIN, self.file_info['ID']))     -        except BadHeader, e: -            if e.code == 403: -                self.setWait(300, True) -                self.wait() -                self.retry(max_tries = 24, reason = "Download limit reached") -            else: raise -         -    def handlePremium(self): -        found = re.search(self.PREMIUM_URL_PATTERN, self.html) -        if not found: self.parseError("Premium URL") -        url = html_unescape(found.group(1)) -        self.logDebug("Premium URL: " + url)         -        if not url.startswith("http://"): self.resetAccount() -        self.download(url) - -getInfo = create_getInfo(CoolshareCz)
\ No newline at end of file diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py index a7935c744..171fba0ff 100644 --- a/module/plugins/hoster/CramitIn.py +++ b/module/plugins/hoster/CramitIn.py @@ -5,7 +5,7 @@ class CramitIn(XFileSharingPro):      __name__ = "CramitIn"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)*cramit.in/\w{12}" -    __version__ = "0.03" +    __version__ = "0.04"      __description__ = """Cramit.in hoster plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -15,6 +15,6 @@ class CramitIn(XFileSharingPro):      HOSTER_NAME = "cramit.in"      def setup(self): -        self.multiDL = self.premium +        self.resumeDownload = self.multiDL = self.premium   getInfo = create_getInfo(CramitIn)
\ No newline at end of file diff --git a/module/plugins/hoster/CyberlockerCh.py b/module/plugins/hoster/CyberlockerCh.py new file mode 100644 index 000000000..57dd26787 --- /dev/null +++ b/module/plugins/hoster/CyberlockerCh.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class CyberlockerCh(XFileSharingPro): +    __name__ = "CyberlockerCh" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?cyberlocker\.ch/\w{12}" +    __version__ = "0.01" +    __description__ = """Cyberlocker.ch hoster plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    HOSTER_NAME = "cyberlocker.ch" + +getInfo = create_getInfo(CyberlockerCh) diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 538e3ed86..a4a811e82 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -17,42 +17,24 @@  """  import re -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo -from module.network.RequestFactory import getURL - -def toInfoPage(url): -    if r"/download.php?" in url: -        try: -            id = re.search(r"id=(\d+)", url).group(1) -            code = re.search(r"code=(\w+)", url).group(1) -        except Exception, e: -            return None -        return "http://czshare.com/%s/%s/" % (id, code) -    return url - -def getInfo(urls): -    result = [] - -    for url in urls: -        info_url = toInfoPage(url) -        if info_url: -            file_info = parseFileInfo(CzshareCom, url, getURL(info_url, decode=True))  -            result.append(file_info) -             -    yield result +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError +from module.utils import parseFileSize  class CzshareCom(SimpleHoster):      __name__ = "CzshareCom"      __type__ = "hoster"      __pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/(\d+/|download.php\?).*" -    __version__ = "0.88" +    __version__ = "0.92"      __description__ = """CZshare.com"""      __author_name__ = ("zoidberg")      FILE_NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>'      FILE_SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[0-9., ]+)(?P<U>[kKMG])i?B\s*</div>'      FILE_OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">' +          FILE_SIZE_REPLACEMENTS = [(' ', '')] +    FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://czshare.com/\1/x/')] +    SH_CHECK_TRAFFIC = True      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>' @@ -65,20 +47,7 @@ class CzshareCom(SimpleHoster):          self.multiDL = self.resumeDownload = True if self.premium else False          self.chunkLimit = 1 -    def process(self, pyfile): -        url = toInfoPage(pyfile.url) -        if not url: -            self.logError(e) -            self.fail("Invalid URL") - -        self.html = self.load(url, cookies=True, decode=True) -        self.getFileInfo() - -        if not self.account or not self.handlePremium(): -            self.handleFree() -        self.checkDownloadedFile() - -    def handlePremium(self): +    def checkTrafficLeft(self):          # check if user logged in          found = re.search(self.USER_CREDIT_PATTERN, self.html)          if not found: @@ -89,17 +58,19 @@ class CzshareCom(SimpleHoster):          # check user credit          try: -            credit = float(found.group(1).replace(',','.').replace(' ','')) -            credit = credit * 1024 ** {'KB': 0, 'MB': 1, 'GB': 2}[found.group(2)] +            credit = parseFileSize(found.group(1).replace(' ',''), found.group(2))              self.logInfo("Premium download for %i KiB of Credit" % (self.pyfile.size / 1024)) -            self.logInfo("User %s has %i KiB left" % (self.user, credit)) -            if credit * 1024 < self.pyfile.size: +            self.logInfo("User %s has %i KiB left" % (self.user, credit / 1024)) +            if credit < self.pyfile.size:                  self.logInfo("Not enough credit to download file %s" % self.pyfile.name) -                self.resetAccount() +                return False          except Exception, e:              # let's continue and see what happens...              self.logError('Parse error (CREDIT): %s' % e) - +         +        return True  +     +    def handlePremium(self):                  # parse download link          try:              form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.DOTALL).group(1) @@ -110,22 +81,20 @@ class CzshareCom(SimpleHoster):          # download the file, destination is determined by pyLoad          self.download("http://czshare.com/profi_down.php", cookies=True, post=inputs) -        return True +        self.checkDownloadedFile()      def handleFree(self):          # get free url          found = re.search(self.FREE_URL_PATTERN, self.html)          if found is None: -           raise PluginParseError('Free URL') +            raise PluginParseError('Free URL')          parsed_url = "http://czshare.com" + found.group(1)          self.logDebug("PARSED_URL:" + parsed_url)          # get download ticket and parse html -        self.html = self.load(parsed_url, cookies=True) - -        #if not re.search(self.FREE_FORM_PATTERN, self.html): +        self.html = self.load(parsed_url, cookies=True, decode=True)          if re.search(self.MULTIDL_PATTERN, self.html): -           self.waitForFreeSlot() +            self.longWait(300, 12)          try:              form = re.search(self.FREE_FORM_PATTERN, self.html, re.DOTALL).group(1) @@ -135,12 +104,20 @@ class CzshareCom(SimpleHoster):              self.logError(e)              raise PluginParseError('Form') -        # get and decrypt captcha +        # get and decrypt captcha                  captcha_url = 'http://czshare.com/captcha.php' -        inputs['captchastring2'] = self.decryptCaptcha(captcha_url) -        self.logDebug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + inputs['captchastring2']) - -        self.html = self.load(parsed_url, cookies=True, post=inputs) +        for i in range(5): +            inputs['captchastring2'] = self.decryptCaptcha(captcha_url) +            self.html = self.load(parsed_url, cookies=True, post=inputs, decode=True) +            if u"<li>Zadaný ověřovací kód nesouhlasí!</li>" in self.html: +                self.invalidCaptcha() +            elif re.search(self.MULTIDL_PATTERN, self.html): +                self.longWait(300, 12) +            else: +                self.correctCaptcha() +                break +        else: +            self.fail("No valid captcha code entered")          found = re.search("countdown_number = (\d+);", self.html)          self.setWait(int(found.group(1)) if found else 50) @@ -155,26 +132,26 @@ class CzshareCom(SimpleHoster):          self.wait()           self.multiDL = True            -        self.download(url)     +        self.download(url) +        self.checkDownloadedFile()      def checkDownloadedFile(self):          # check download          check = self.checkDownload({ -            "tempoffline": re.compile(r"^Soubor je do.asn. nedostupn.$"), +            "tempoffline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), +            "credit": re.compile(r"^Nem.*te dostate.*n.* kredit.$"),              "multi_dl": re.compile(self.MULTIDL_PATTERN),              "captcha_err": "<li>Zadaný ověřovací kód nesouhlasí!</li>"              })          if check == "tempoffline":              self.fail("File not available - try later") +        if check == "credit": +            self.resetAccount()          elif check == "multi_dl": -            self.waitForFreeSlot() +            self.longWait(300, 12)          elif check == "captcha_err":              self.invalidCaptcha()              self.retry() - -    def waitForFreeSlot(self, wait_time = 300): -        self.multiDL = False -        self.setWait(wait_time, True) -        self.wait() -        self.retry()
\ No newline at end of file +         +getInfo = create_getInfo(CzshareCom) diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py new file mode 100644 index 000000000..1b411393d --- /dev/null +++ b/module/plugins/hoster/DailymotionCom.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from urllib import unquote +from module.plugins.Hoster import Hoster + +class DailymotionCom(Hoster): +    __name__ = 'DailymotionCom' +    __type__ = 'hoster' +    __pattern__ = r'http://www.dailymotion.com/.*' +    __version__ = '0.1' +    __description__ = """Dailymotion Video Download Hoster""" +    __author_name__ = ("Peekayy") +    __author_mail__ = ("peekayy.dev@gmail.com") + +    def process(self, pyfile): +        html = self.load(pyfile.url, decode=True) + +        for pattern in (r'name="title" content="Dailymotion \\-(.*?)\\- ein Film', +                        r'class="title" title="(.*?)"', +                        r'<span class="title foreground" title="(.*?)">', +                        r'"(?:vs_videotitle|videoTitle|dm_title|ss_mediaTitle)": "(.*?)"'): +            filename = re.search(pattern, html) +            if filename is not None: break +        else: +            self.fail("Unable to find file name") + +        pyfile.name = filename.group(1)+'.mp4' +        self.logDebug('Filename='+pyfile.name) +        allLinksInfo = re.search(r'"sequence":"(.*?)"', html) +        self.logDebug(allLinksInfo.groups()) +        allLinksInfo = unquote(allLinksInfo.group(1)) + +        for quality in ('hd720URL', 'hqURL', 'sdURL', 'ldURL', ''): +            dlLink = self.getQuality(quality, allLinksInfo) +            if dlLink is not None: break +        else: +            self.fail(r'Unable to find video URL') + +        self.logDebug(dlLink) +        self.download(dlLink) + +    def getQuality(self, quality, data): +        link = re.search('"' + quality + '":"(http:[^<>"\']+)"', data) +        if link is not None: +            return link.group(1).replace('\\','')
\ No newline at end of file diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index cef115941..3dc581bf1 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -23,14 +23,15 @@ from pycurl import FOLLOWLOCATION  class DataportCz(SimpleHoster):      __name__ = "DataportCz"      __type__ = "hoster" -    __pattern__ = r"http://.*dataport.cz/file/.*" -    __version__ = "0.35" +    __pattern__ = r"http://(?:.*?\.)?dataport.cz/file/(.*)" +    __version__ = "0.37"      __description__ = """Dataport.cz plugin - free only"""      __author_name__ = ("zoidberg")      FILE_NAME_PATTERN = r'<span itemprop="name">(?P<N>[^<]+)</span>'      FILE_SIZE_PATTERN = r'<td class="fil">Velikost</td>\s*<td>(?P<S>[^<]+)</td>'      FILE_OFFLINE_PATTERN = r'<h2>Soubor nebyl nalezen</h2>' +    FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')]      CAPTCHA_URL_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"'         FREE_SLOTS_PATTERN = ur'Počet volných slotů: <span class="darkblue">(\d+)</span><br />' @@ -49,7 +50,7 @@ class DataportCz(SimpleHoster):              else:                  raise PluginParseError('captcha') -            self.html = self.download("http://dataport.cz%s" % action, post = inputs) +            self.html = self.download("http://www.dataport.cz%s" % action, post = inputs)              check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");',                                          "slot": 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 529a5a06f..8d994c179 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -24,7 +24,7 @@ class DateiTo(SimpleHoster):      __name__ = "DateiTo"      __type__ = "hoster"      __pattern__ = r"http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html" -    __version__ = "0.01" +    __version__ = "0.02"      __description__ = """Datei.to plugin - free only"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -77,6 +77,8 @@ class DateiTo(SimpleHoster):      def checkErrors(self):          found = re.search(self.PARALELL_PATTERN, self.html)          if found: +            found = re.search(self.WAIT_PATTERN, self.html) +            wait_time = int(found.group(1)) if found else 30              self.setWait(wait_time + 1, False)              self.wait(300)              self.retry() diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py new file mode 100644 index 000000000..5142bbdf7 --- /dev/null +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Hoster import Hoster + + +class DebridItaliaCom(Hoster): +    __name__ = "DebridItaliaCom" +    __version__ = "0.01" +    __type__ = "hoster" +    __pattern__ = r"https?://.*debriditalia\.com" +    __description__ = """Debriditalia.com hoster plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    def init(self): +        self.chunkLimit = -1 +        self.resumeDownload = True + +    def process(self, pyfile): +        if not self.account: +            self.logError("Please enter your DebridItalia account or deactivate this plugin") +            self.fail("No DebridItalia account provided") + +        self.logDebug("Old URL: %s" % pyfile.url) +        if re.match(self.__pattern__, pyfile.url): +            new_url = pyfile.url +        else: +            url = "http://debriditalia.com/linkgen2.php?xjxfun=convertiLink&xjxargs[]=S<![CDATA[%s]]>" % pyfile.url +            page = self.load(url) +            self.logDebug("XML data: %s" % page) + +            new_url = re.search(r'<a href="(?:[^"]+)">(?P<direct>[^<]+)</a>', page).group('direct') + +        self.logDebug("New URL: %s" % new_url) + +        self.download(new_url, disposition=True)
\ No newline at end of file diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 9c13a5f3a..eb64ae4de 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -10,8 +10,8 @@ from module.plugins.ReCaptcha import ReCaptcha  class DepositfilesCom(SimpleHoster):      __name__ = "DepositfilesCom"      __type__ = "hoster" -    __pattern__ = r"http://[\w\.]*?depositfiles\.com(/\w{1,3})?/files/[\w]+" -    __version__ = "0.42" +    __pattern__ = r"http://[\w\.]*?(depositfiles\.com|dfiles\.eu)(/\w{1,3})?/files/[\w]+" +    __version__ = "0.43"      __description__ = """Depositfiles.com Download Hoster"""      __author_name__ = ("spoob", "zoidberg")      __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") @@ -24,7 +24,7 @@ class DepositfilesCom(SimpleHoster):      FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )]      RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'" -    DOWNLOAD_LINK_PATTERN = r'<form action="(http://.+?\.depositfiles.com/.+?)" method="get"' +    DOWNLOAD_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"'      def setup(self):          self.multiDL = False @@ -109,4 +109,4 @@ class DepositfilesCom(SimpleHoster):          self.multiDL = True          self.download(link, disposition = True) -getInfo = create_getInfo(DepositfilesCom)
\ No newline at end of file +getInfo = create_getInfo(DepositfilesCom) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 5b318fd54..67c2d6c17 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -92,7 +92,7 @@ class DlFreeFr(SimpleHoster):      __name__ = "DlFreeFr"      __type__ = "hoster"      __pattern__ = r"http://dl\.free\.fr/([a-zA-Z0-9]+|getfile\.pl\?file=/[a-zA-Z0-9]+)" -    __version__ = "0.23" +    __version__ = "0.24"      __description__ = """dl.free.fr download hoster"""      __author_name__ = ("the-razer", "zoidberg", "Toilal")      __author_mail__ = ("daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", "toilal.dev@gmail.com") @@ -145,7 +145,7 @@ class DlFreeFr(SimpleHoster):          result = adyoulike.result(ayl, challenge)          inputs.update(result) -        data = self.load("http://dl.free.fr/getfile.pl", post = inputs)   +        self.load("http://dl.free.fr/getfile.pl", post = inputs)            headers = self.getLastHeaders()                 if headers.get("code") == 302 and headers.has_key("set-cookie") and headers.has_key("location"):              found = re.search("(.*?)=(.*?); path=(.*?); domain=(.*?)", headers.get("set-cookie")) diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index 5f3159b20..0deaa782e 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -25,7 +25,7 @@ class EasybytezCom(XFileSharingPro):      __name__ = "EasybytezCom"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)?easybytez.com/(\w+).*" -    __version__ = "0.11" +    __version__ = "0.12"      __description__ = """easybytez.com"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -38,6 +38,7 @@ class EasybytezCom(XFileSharingPro):      DIRECT_LINK_PATTERN = r'(http://(\w+\.easybytez\.com|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/[^"<]+)'      OVR_DOWNLOAD_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)'      OVR_KILL_LINK_PATTERN = r'<h2>Delete Link</h2>\s*<textarea[^>]*>([^<]+)' +    ERROR_PATTERN = r'(?:class=["\']err["\'][^>]*>|<Center><b>)(.*?)</'      HOSTER_NAME = "easybytez.com" diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py new file mode 100644 index 000000000..b27abb416 --- /dev/null +++ b/module/plugins/hoster/EgoFilesCom.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*-
 +
 +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 +from module.plugins.ReCaptcha import ReCaptcha
 +import re
 +
 +
 +class EgoFilesCom(SimpleHoster):
 +    __name__ = "EgoFilesCom"
 +    __type__ = "hoster"
 +    __pattern__ = r"https?://(www\.)?egofiles.com/(\w+)"
 +    __version__ = "0.10"
 +    __description__ = """Egofiles.com Download Hoster"""
 +    __author_name__ = ("stickell")
 +    __author_mail__ = ("l.stickell@yahoo.it")
 +
 +    FILE_INFO_PATTERN = r'<div class="down-file">\s+(?P<N>\S+)\s+<div class="file-properties">\s+(File size|Rozmiar): (?P<S>[\w.]+) (?P<U>\w+) \|'
 +    FILE_OFFLINE_PATTERN = r'(File size|Rozmiar): 0 KB'
 +    WAIT_TIME_PATTERN = r'For next free download you have to wait <strong>((?P<m>\d*)m)? ?((?P<s>\d+)s)?</strong>'
 +    DIRECT_LINK_PATTERN = r'<a href="(?P<link>[^"]+)">Download ></a>'
 +    RECAPTCHA_KEY = '6LeXatQSAAAAAHezcjXyWAni-4t302TeYe7_gfvX'
 +
 +    def init(self):
 +        self.file_info = {}
 +        # Set English language
 +        self.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True)
 +
 +    def handleFree(self):
 +        self.html = self.load(self.pyfile.url, decode=True)
 +
 +        # Wait time between free downloads
 +        if 'For next free download you have to wait' in self.html:
 +            m = re.search(self.WAIT_TIME_PATTERN, self.html).groupdict('0')
 +            waittime = int(m['m']) * 60 + int(m['s'])
 +            self.setWait(waittime, True)
 +            self.wait()
 +
 +        downloadURL = ''
 +        recaptcha = ReCaptcha(self)
 +        for i in xrange(5):
 +            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
 +            post_data = {'recaptcha_challenge_field': challenge,
 +                         'recaptcha_response_field': response}
 +            self.html = self.load(self.pyfile.url, post=post_data, decode=True)
 +            m = re.search(self.DIRECT_LINK_PATTERN, self.html)
 +            if not m:
 +                self.logInfo('Wrong captcha')
 +                self.invalidCaptcha()
 +            elif hasattr(m, 'group'):
 +                downloadURL = m.group('link')
 +                self.correctCaptcha()
 +                break
 +            else:
 +                self.fail('Unknown error - Plugin may be out of date')
 +
 +        if not downloadURL:
 +            self.fail("No Download url retrieved/all captcha attempts failed")
 +
 +        self.download(downloadURL)
 +
 +    def handlePremium(self):
 +        header = self.load(self.pyfile.url, just_header=True)
 +        if header.has_key('location'):
 +            self.logDebug('DIRECT LINK from header: ' + header['location'])
 +            self.download(header['location'])
 +        else:
 +            self.html = self.load(self.pyfile.url, decode=True)
 +            m = re.search(r'<a href="(?P<link>[^"]+)">Download ></a>', self.html)
 +            if not m:
 +                self.parseError('Unable to detect direct download url')
 +            else:
 +                self.logDebug('DIRECT URL from html: ' + m.group('link'))
 +                self.download(m.group('link'))
 +
 +getInfo = create_getInfo(EgoFilesCom)
 diff --git a/module/plugins/hoster/EnteruploadCom.py b/module/plugins/hoster/EnteruploadCom.py deleted file mode 100644 index 2c99b0047..000000000 --- a/module/plugins/hoster/EnteruploadCom.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- 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.DeadHoster import DeadHoster as SimpleHoster, create_getInfo
 -
 -class EnteruploadCom(SimpleHoster):
 -    __name__ = "EnteruploadCom"
 -    __type__ = "hoster"
 -    __pattern__ = r"http://(?:www\.)?enterupload.com/\w+.*"
 -    __version__ = "0.02"
 -    __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>'
 -    TEMP_OFFLINE_PATTERN = r'>This server is in maintenance mode\. Refresh this page in some minutes\.<'   
 -    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/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 1e1cc0b4b..5224dfd9f 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -17,54 +17,58 @@  """  import re -from module.plugins.Hoster import Hoster -from module.network.RequestFactory import getURL +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -def getInfo(urls): -    result = [] - -    for url in urls: - -        html = getURL(url, decode=True) -        if re.search(EuroshareEu.FILE_OFFLINE_PATTERN, html): -            # File offline -            result.append((url, 0, 1, url)) -        else: -            result.append((url, 0, 2, url)) -    yield result - -class EuroshareEu(Hoster): +class EuroshareEu(SimpleHoster):      __name__ = "EuroshareEu"      __type__ = "hoster" -    __pattern__ = r"http://(\w*\.)?euroshare.eu/file/.*" -    __version__ = "0.30" +    __pattern__ = r"http://(\w*\.)?euroshare.(eu|sk|cz|hu|pl)/file/.*" +    __version__ = "0.25"      __description__ = """Euroshare.eu"""      __author_name__ = ("zoidberg") -    URL_PATTERN = r'<a class="free" href="([^"]+)"></a>' -    FILE_OFFLINE_PATTERN = r'<h2>S.bor sa nena.iel</h2>' -    ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>' - -    def setup(self): -        self.multiDL = False +    FILE_INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' +    FILE_OFFLINE_PATTERN = ur'<h2>S.bor sa nena.iel</h2>|Požadovaná stránka neexistuje!' -    def process(self, pyfile): -        self.html = self.load(pyfile.url, decode=True) +    FREE_URL_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' +    ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' +    ERR_NOT_LOGGED_IN_PATTERN = r'href="/customer-zone/login/"' -        if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: -            self.offline() +    FILE_URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] +    def setup(self): +        self.multiDL = self.resumeDownload = self.premium +        self.req.setOption("timeout", 120) + +    def handlePremium(self): +        if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: +            self.account.relogin(self.user) +            self.retry(reason="User not logged in") + +        self.download(self.pyfile.url.rstrip('/') + "/download/") + +        check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN), +                                    "json": re.compile(r'\{"status":"error".*?"message":"(.*?)"') +                                   }) +        if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"): +            self.account.relogin(self.user) +            self.retry(reason="Access token expired") +        elif check == "json": +            self.fail(self.lastCheck.group(1)) + +    def handleFree(self):          if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: -            self.waitForFreeSlot() +            self.longWait(300, 12) -        found = re.search(self.URL_PATTERN, self.html) +        found = re.search(self.FREE_URL_PATTERN, self.html)          if found is None: -            self.fail("Parse error (URL)") -        parsed_url = found.group(1) - +            self.parseError("Parse error (URL)") +        parsed_url = "http://euroshare.eu%s" % found.group(1) +        self.logDebug("URL", parsed_url)          self.download(parsed_url, disposition=True) -    def waitForFreeSlot(self): -        self.setWait(300, True) -        self.wait() -        self.retry()
\ No newline at end of file +        check = self.checkDownload({"multi_dl": re.compile(self.ERR_PARDL_PATTERN)}) +        if check == "multi_dl": +            self.longWait(300, 12) + +getInfo = create_getInfo(EuroshareEu)
\ No newline at end of file diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 654a1abe8..cc0b18c96 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -23,30 +23,55 @@ class FastshareCz(SimpleHoster):      __name__ = "FastshareCz"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)?fastshare.cz/\d+/.+" -    __version__ = "0.12" +    __version__ = "0.14"      __description__ = """FastShare.cz"""      __author_name__ = ("zoidberg") -    FILE_NAME_PATTERN = r'<h3><b><span style=color:black;>(?P<N>[^<]+)</b></h3>' +    FILE_NAME_PATTERN = r'<h[23]><b><span style=color:black;>(?P<N>[^<]+)</b></h[23]>'      FILE_SIZE_PATTERN = r'<tr><td>Velikost: </td><td style=font-weight:bold>(?P<S>[^<]+)</td></tr>' -    FILE_OFFLINE_PATTERN = r'<div id="content">\s*<div style=background-color:white' -    SH_HTML_ENCODING = 'cp1250' +    FILE_OFFLINE_PATTERN = ur'<td align=center>Tento soubor byl smazán' +    SH_COOKIES = [("fastshare.cz","lang","cs")] +    FILE_URL_REPLACEMENTS = [('#.*','')]      FREE_URL_PATTERN = ur'<form method=post action=(/free/.*?)><b>Stáhnout FREE.*?<img src="([^"]*)">' +    PREMIUM_URL_PATTERN = r'(http://data\d+\.fastshare\.cz/download\.php\?id=\d+\&[^\s\"\'<>]+)' +    NOT_ENOUGH_CREDIC_PATTERN = "Nem.te dostate.n. kredit pro sta.en. tohoto souboru"      def handleFree(self): +        if u">100% FREE slotů je plných.<" in self.html: +            self.setWait(60, False) +            self.wait() +            self.retry(120, "No free slots") +          found = re.search(self.FREE_URL_PATTERN, self.html)          if not found: self.parseError("Free URL")          action, captcha_src = found.groups()          captcha = self.decryptCaptcha("http://www.fastshare.cz/" + captcha_src)          self.download("http://www.fastshare.cz/" + action, post = {"code": captcha, "submit": u"stáhnout"}) -        check = self.checkDownload({"paralell_dl": "<script>alert('Pres FREE muzete stahovat jen jeden soubor najednou.')"}) +        check = self.checkDownload({ +            "paralell_dl": "<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)" +            })          self.logDebug(self.req.lastEffectiveURL, self.req.lastURL, self.req.code)          if check == "paralell_dl":              self.setWait(600, True)              self.wait() -            self.retry() +            self.retry(6, "Paralell download") + +    def handlePremium(self): +        if self.NOT_ENOUGH_CREDIC_PATTERN in self.html: +            self.logWarning('Not enough traffic left') +            self.resetAccount() + +        found = re.search(self.PREMIUM_URL_PATTERN, self.html) +        if not found: self.parseError("Premium URL") +        url = found.group(1) +        self.logDebug("PREMIUM URL: %s" % url) +        self.download(url) + +        check = self.checkDownload({"credit": re.compile(self.NOT_ENOUGH_CREDIC_PATTERN)}) +        if check == "credit": +            self.resetAccount()  getInfo = create_getInfo(FastshareCz)
\ No newline at end of file diff --git a/module/plugins/hoster/FilebeerInfo.py b/module/plugins/hoster/FilebeerInfo.py new file mode 100644 index 000000000..216ecfbca --- /dev/null +++ b/module/plugins/hoster/FilebeerInfo.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class FilebeerInfo(DeadHoster): +    __name__ = "FilebeerInfo" +    __type__ = "hoster" +    __pattern__ = r"http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+).*" +    __version__ = "0.03" +    __description__ = """Filebeer.info plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") + + +getInfo = create_getInfo(FilebeerInfo)
\ No newline at end of file diff --git a/module/plugins/hoster/FiledinoCom.py b/module/plugins/hoster/FiledinoCom.py deleted file mode 100644 index 6bdd01b51..000000000 --- a/module/plugins/hoster/FiledinoCom.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo -import re - -class FiledinoCom(XFileSharingPro): -    __name__ = "FiledinoCom" -    __type__ = "hoster" -    __pattern__ = r"http://(?:\w*\.)*(file(dino|fat).com)/\w{12}" -    __version__ = "0.02" -    __description__ = """FileDino / FileFat hoster plugin""" -    __author_name__ = ("zoidberg") -    __author_mail__ = ("zoidberg@mujmail.cz") -     -    FILE_SIZE_PATTERN = r'File Size : </(span|font)><(span|font)[^>]*>(?P<S>.+?)</(span|font)>' -    DIRECT_LINK_PATTERN = r'http://www\.file(dino|fat)\.com/cgi-bin/dl\.cgi/' -     -    def setup(self): -        self.HOSTER_NAME = re.search(self.__pattern__, self.pyfile.url).group(1) -        self.multiDL = False  - -getInfo = create_getInfo(FiledinoCom)
\ No newline at end of file diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 135dd90a1..66d26c999 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -9,7 +9,6 @@ from module.common.json_layer import json_loads  import re  def checkFile(plugin, urls): -    file_info = []      url_dict = {}      for url in urls: @@ -35,7 +34,7 @@ class FilefactoryCom(Hoster):      __name__ = "FilefactoryCom"      __type__ = "hoster"      __pattern__ = r"http://(?:www\.)?filefactory\.com/file/(?P<id>[a-zA-Z0-9]+).*" # URLs given out are often longer but this is the requirement -    __version__ = "0.34" +    __version__ = "0.36"      __description__ = """Filefactory.Com File Download Hoster"""      __author_name__ = ("paulking", "zoidberg") @@ -112,13 +111,15 @@ class FilefactoryCom(Hoster):                  self.invalidCaptcha()                                      else:              self.fail("No valid captcha after 5 attempts") -         +          # This will take us to a wait screen          waiturl = "http://www.filefactory.com" + response['path']          self.logDebug("Fetching wait with url [%s]" % waiturl)          waithtml = self.load(waiturl, decode=True) +        found = re.search(r'<a href="(http://www.filefactory.com/dlf/.*?)"', waithtml) +        waithtml = self.load(found.group(1), decode=True) -        # Find the wait value and wait      +        # Find the wait value and wait          wait = int(re.search(self.WAIT_PATTERN, waithtml).group('wait'))          self.logDebug("Waiting %d seconds." % wait)          self.setWait(wait, True) @@ -128,7 +129,7 @@ class FilefactoryCom(Hoster):          url = re.search(self.FILE_URL_PATTERN,waithtml).group('url')          # this may either download our file or forward us to an error page          self.logDebug("Download URL: %s" % url) -        dl = self.download(url) +        self.download(url)          check = self.checkDownload({"multiple": "You are currently downloading too many files at once.",                                      "error": '<div id="errorMessage">'}) diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py index 3d983bedf..7be0fa4f6 100644 --- a/module/plugins/hoster/FilerioCom.py +++ b/module/plugins/hoster/FilerioCom.py @@ -4,17 +4,17 @@ from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInf  class FilerioCom(XFileSharingPro):      __name__ = "FilerioCom"      __type__ = "hoster" -    __pattern__ = r"http://(?:\w*\.)*file(rio|keen).com/\w{12}" -    __version__ = "0.01" -    __description__ = """FileRio.com hoster plugin""" +    __pattern__ = r"http://(?:\w*\.)*(filerio\.(in|com)|filekeen\.com)/\w{12}" +    __version__ = "0.02"                              +    __description__ = """FileRio.in hoster plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz")      FILE_OFFLINE_PATTERN = '<b>"File Not Found"</b>|File has been removed due to Copyright Claim' -    HOSTER_NAME = "filerio.com" -    DIRECT_LINK_PATTERN = r'Download Link:.*?<a href="(.*?)"' +    HOSTER_NAME = "filerio.in" +    FILE_URL_REPLACEMENTS = [(r'http://.*?/','http://filerio.in/')]      def setup(self): -        self.multiDL = False  +        self.resumeDownload = self.multiDL = self.premium   getInfo = create_getInfo(FilerioCom)
\ No newline at end of file diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 1284329b5..ee4ea4953 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -31,7 +31,7 @@ class FilesMailRu(Hoster):      __name__ = "FilesMailRu"      __type__ = "hoster"      __pattern__ = r"http://files\.mail\.ru/.*" -    __version__ = "0.2" +    __version__ = "0.3"      __description__ = """Files.Mail.Ru One-Klick Hoster"""      __author_name__ = ("oZiRiz")      __author_mail__ = ("ich@oziriz.de") @@ -95,5 +95,5 @@ class FilesMailRu(Hoster):          # (Loading 100MB in to ram is not an option)          check = self.checkDownload({"html": "<meta name="}, read_size=50000)          if check == "html": -            self.log.info(_("There was HTML Code in the Downloaded File("+ pyfile.name +")...redirect error? The Download will be restarted.")) +            self.log.info(_("There was HTML Code in the Downloaded File("+ self.pyfile.name +")...redirect error? The Download will be restarted."))              self.retry() diff --git a/module/plugins/hoster/FileshareInUa.py b/module/plugins/hoster/FileshareInUa.py new file mode 100644 index 000000000..9700b2d0a --- /dev/null +++ b/module/plugins/hoster/FileshareInUa.py @@ -0,0 +1,78 @@ +from urllib import urlencode +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL +from module.utils import parseFileSize + +class FileshareInUa(Hoster): +    __name__ = "FileshareInUa" +    __type__ = "hoster" +    __pattern__ = r"http://(?:\w*\.)*?fileshare.in.ua/[A-Za-z0-9]+" +    __version__ = "0.01" +    __description__ = """fileshare.in.ua hoster plugin""" +    __author_name__ = ("fwannmacher") +    __author_mail__ = ("felipe@warhammerproject.com") +     +    HOSTER_NAME = "fileshare.in.ua" +    PATTERN_FILENAME = r'<h3 class="b-filename">(.*?)</h3>' +    PATTERN_FILESIZE = r'<b class="b-filesize">(.*?)</b>' +    PATTERN_OFFLINE = "This file doesn't exist, or has been removed." +     +    def setup(self): +        self.resumeDownload = True +        self.multiDL = True + +    def process(self, pyfile): +        self.pyfile = pyfile +        self.html = self.load(pyfile.url, decode=True) + +        if not self._checkOnline(): +            self.offline() +         +        self.pyfile.name = self._getName() +         +        self.link = self._getLink() +         +        if not self.link.startswith('http://'): +            self.link = "http://fileshare.in.ua" + self.link + +        self.download(self.link)          + +    def _checkOnline(self): +        if re.search(self.PATTERN_OFFLINE, self.html): +            return False +        else: +            return True +         +    def _getName(self): +        name = re.search(self.PATTERN_FILENAME, self.html) +        if name is None: +            self.fail("%s: Plugin broken." % self.__name__) + +        return name.group(1) +         +    def _getLink(self):  +        return re.search("<a href=\"(/get/.+)\" class=\"b-button m-blue m-big\" >", self.html).group(1) + +def getInfo(urls): +    result = [] +     +    for url in urls:  +        html = getURL(url) +         +        if re.search(FileshareInUa.PATTERN_OFFLINE, html): +            result.append((url, 0, 1, url)) +        else: +            name = re.search(FileshareInUa.PATTERN_FILENAME, html) +             +            if name is None: +                result.append((url, 0, 1, url)) +                continue +                 +            name = name.group(1) +            size = re.search(FileshareInUa.PATTERN_FILESIZE, html) +            size = parseFileSize(size.group(1))  +             +            result.append((name, size, 3, url)) + +    yield result diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py deleted file mode 100644 index b35ce1b1f..000000000 --- a/module/plugins/hoster/FilesonicCom.py +++ /dev/null @@ -1,217 +0,0 @@ -#!/usr/bin/env python
 -# -*- coding: utf-8 -*-
 -
 -import re
 -import string
 -from urllib import unquote
 -
 -from module.plugins.Hoster import Hoster
 -from module.plugins.ReCaptcha import ReCaptcha
 -from module.utils import chunks
 -
 -from module.network.RequestFactory import getURL
 -from module.common.json_layer import json_loads
 -
 -
 -def getInfo(urls):
 -    yield [(url, 0, 1, url) for url in urls]
 -
 -
 -def getId(url):
 -    match = re.search(FilesonicCom.FILE_ID_PATTERN, url)
 -    if match:
 -        return string.replace(match.group("id"), "/", "-")
 -    else:
 -        return None
 -
 -
 -class FilesonicCom(Hoster):
 -    __name__ = "FilesonicCom"
 -    __type__ = "hoster"
 -    __pattern__ = r"http://[\w\.]*?(sharingmatrix|filesonic)\..*?/.*?file/([a-zA-Z0-9]+(/.+)?|[a-z0-9]+/[0-9]+(/.+)?|[0-9]+(/.+)?)"
 -    __version__ = "0.36"
 -    __description__ = """FilesonicCom und Sharingmatrix Download Hoster"""
 -    __author_name__ = ("jeix", "paulking")
 -    __author_mail__ = ("jeix@hasnomail.de", "")
 -
 -    API_ADDRESS = "http://api.filesonic.com"
 -    URL_DOMAIN_PATTERN = r'(?P<prefix>.*?)(?P<domain>.(filesonic|sharingmatrix)\..+?)(?P<suffix>/.*)'
 -    FILE_ID_PATTERN = r'/file/(?P<id>([a-z][0-9]+/)?[a-zA-Z0-9\-._+]+)(/.*)?' #change may break wupload - be careful
 -    FILE_LINK_PATTERN = r'Your download is ready</p>\s*<a href="(http://[^"]+)'
 -    WAIT_TIME_PATTERN = r'countDownDelay = (?P<wait>\d+)'
 -    WAIT_TM_PATTERN = r"name='tm' value='(.*?)' />"
 -    WAIT_TM_HASH_PATTERN = r"name='tm_hash' value='(.*?)' />"
 -    CAPTCHA_TYPE1_PATTERN = r'Recaptcha.create\("(.*?)",'
 -    CAPTCHA_TYPE2_PATTERN = r'id="recaptcha_image"><img style="display: block;" src="(.+)image?c=(.+?)"'
 -
 -    def init(self):
 -        if self.account:
 -            self.premium = self.account.getAccountInfo(self.user)["premium"]
 -        if not self.premium:
 -            self.chunkLimit = 1
 -            self.multiDL = False
 -
 -    def process(self, pyfile):
 -        self.fail("Hoster not longer available")
 -
 -    def checkFile(self, url):
 -        id = getId(url)
 -        self.logDebug("file id is %s" % id)
 -        if id:
 -            # Use the api to check the current status of the file and fixup data
 -            check_url = self.API_ADDRESS + "/link?method=getInfo&format=json&ids=%s" % id
 -            result = json_loads(self.load(check_url, decode=True))
 -            item = result["FSApi_Link"]["getInfo"]["response"]["links"][0]
 -            self.logDebug("api check returns %s" % item)
 -
 -            if item["status"] != "AVAILABLE":
 -                self.offline()
 -            if item["is_password_protected"] != 0:
 -                self.fail("This file is password protected")
 -
 -            # ignored this check due to false api information
 -            #if item["is_premium_only"] != 0 and not self.premium:
 -            #    self.fail("need premium account for file")
 -
 -            self.pyfile.name = unquote(item["filename"])
 -
 -            # Fix the url and resolve the domain to the correct regional variation
 -            url = item["url"]
 -            urlparts = re.search(self.URL_DOMAIN_PATTERN, url)
 -            if urlparts:
 -                url = urlparts.group("prefix") + self.getDomain() + urlparts.group("suffix")
 -                self.logDebug("localised url is %s" % url)
 -            return url
 -        else:
 -            self.fail("Invalid URL")
 -
 -    def getDomain(self):
 -        result = json_loads(
 -            self.load(self.API_ADDRESS + "/utility?method=getFilesonicDomainForCurrentIp&format=json", decode=True))
 -        self.logDebug("response to get domain %s" % result)
 -        return result["FSApi_Utility"]["getFilesonicDomainForCurrentIp"]["response"]
 -
 -
 -    def downloadPremium(self):
 -        self.logDebug("Premium download")
 -
 -        api = self.API_ADDRESS + "/link?method=getDownloadLink&u=%%s&p=%%s&ids=%s" % getId(self.pyfile.url)
 -
 -        result = json_loads(self.load(api % (self.user, self.account.getAccountData(self.user)["password"])))
 -        links = result["FSApi_Link"]["getDownloadLink"]["response"]["links"]
 -
 -        #wupload seems to return list and no dicts
 -        if type(links) == dict:
 -            info = links.values()[0]
 -        else:
 -            info = links[0]
 -
 -        if "status" in info and info["status"] == "NOT_AVAILABLE":
 -            self.tempOffline()
 -
 -        self.download(info["url"])
 -
 -    def downloadFree(self):
 -        self.logDebug("Free download")
 -        # Get initial page
 -        self.html = self.load(self.pyfile.url)
 -        url = self.pyfile.url + "?start=1"
 -        self.html = self.load(url)
 -        self.handleErrors()
 -
 -        finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
 -
 -        if not finalUrl:
 -            self.doWait(url)
 -
 -            chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
 -            chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
 -            if chall or chall2:
 -                for i in range(5):
 -                    re_captcha = ReCaptcha(self)
 -                    if chall:
 -                        self.logDebug("Captcha type1")
 -                        challenge, result = re_captcha.challenge(chall.group(1))
 -                    else:
 -                        self.logDebug("Captcha type2")
 -                        server = chall2.group(1)
 -                        challenge = chall2.group(2)
 -                        result = re_captcha.result(server, challenge)
 -
 -                    postData = {"recaptcha_challenge_field": challenge,
 -                                "recaptcha_response_field": result}
 -
 -                    self.html = self.load(url, post=postData)
 -                    self.handleErrors()
 -                    chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
 -                    chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
 -
 -                    if chall or chall2:
 -                        self.invalidCaptcha()
 -                    else:
 -                        self.correctCaptcha()
 -                        break
 -
 -            finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
 -
 -        if not finalUrl:
 -            self.fail("Couldn't find free download link")
 -
 -        self.logDebug("got download url %s" % finalUrl.group(1))
 -        self.download(finalUrl.group(1))
 -
 -    def doWait(self, url):
 -        # If the current page requires us to wait then wait and move to the next page as required
 -
 -        # There maybe more than one wait period. The extended wait if download limits have been exceeded (in which case we try reconnect)
 -        # and the short wait before every download. Visually these are the same, the difference is that one includes a code to allow
 -        # progress to the next page
 -
 -        waitSearch = re.search(self.WAIT_TIME_PATTERN, self.html)
 -        while waitSearch:
 -            wait = int(waitSearch.group("wait"))
 -            if wait > 300:
 -                self.wantReconnect = True
 -
 -            self.setWait(wait)
 -            self.logDebug("Waiting %d seconds." % wait)
 -            self.wait()
 -
 -            tm = re.search(self.WAIT_TM_PATTERN, self.html)
 -            tm_hash = re.search(self.WAIT_TM_HASH_PATTERN, self.html)
 -
 -            if tm and tm_hash:
 -                tm = tm.group(1)
 -                tm_hash = tm_hash.group(1)
 -                self.html = self.load(url, post={"tm": tm, "tm_hash": tm_hash})
 -                self.handleErrors()
 -                break
 -            else:
 -                self.html = self.load(url)
 -                self.handleErrors()
 -                waitSearch = re.search(self.WAIT_TIME_PATTERN, self.html)
 -
 -    def handleErrors(self):
 -        if "This file is available for premium users only." in self.html:
 -            self.fail("need premium account for file")
 -
 -        if "The file that you're trying to download is larger than" in self.html:
 -            self.fail("need premium account for file")
 -
 -        if "Free users may only download 1 file at a time" in self.html:
 -            self.fail("only 1 file at a time for free users")
 -
 -        if "Free user can not download files" in self.html:
 -            self.fail("need premium account for file")
 -
 -        if "Download session in progress" in self.html:
 -            self.fail("already downloading")
 -
 -        if "This file is password protected" in self.html:
 -            self.fail("This file is password protected")
 -
 -        if "An Error Occurred" in self.html:
 -            self.fail("A server error occured.")
 -
 -        if "This file was deleted" in self.html:
 -            self.offline()
 diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py new file mode 100644 index 000000000..0ffb76191 --- /dev/null +++ b/module/plugins/hoster/FlyFilesNet.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import urllib + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.network.RequestFactory import getURL + +class FlyFilesNet(SimpleHoster): +    __name__ = "FlyFilesNet" +    __version__ = "0.1" +    __type__ = "hoster" +    __pattern__ = r'http://flyfiles\.net/.*' + +    SESSION_PATTERN = r'flyfiles\.net/(.*)/.*' +    FILE_NAME_PATTERN = r'flyfiles\.net/.*/(.*)' + +    def process(self, pyfile): + +        pyfile.name = re.search(self.FILE_NAME_PATTERN, pyfile.url).group(1) +        pyfile.name = urllib.unquote_plus(pyfile.name) + +        session = re.search(self.SESSION_PATTERN, pyfile.url).group(1) + +        url = "http://flyfiles.net" + +        # get download URL +        parsed_url = getURL(url, post={"getDownLink": session}, cookies=True) +        self.logDebug("Parsed URL: %s" % parsed_url) + +        if parsed_url == '#downlink|' or parsed_url == "#downlink|#": +            self.logWarning("Could not get the download URL. Please wait 10 minutes.") +            self.setWait(600, True) # wait 10 minutes +            self.wait() +            self.retry() + +        download_url = parsed_url.replace('#downlink|','') + +        self.logDebug("Download URL: %s" % download_url) +        self.download(download_url) diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 551706283..518ae2ae6 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -7,8 +7,8 @@ import re  class FourSharedCom(SimpleHoster):      __name__ = "FourSharedCom"      __type__ = "hoster" -    __pattern__ = r"http://[\w\.]*?4shared(-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|office)/.+?/.*" -    __version__ = "0.28" +    __pattern__ = r"https?://(www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+?/.*" +    __version__ = "0.29"      __description__ = """4Shared Download Hoster"""      __author_name__ = ("jeix", "zoidberg")      __author_mail__ = ("jeix@hasnomail.de", "zoidberg@mujmail.cz") diff --git a/module/plugins/hoster/FreevideoCz.py b/module/plugins/hoster/FreevideoCz.py index dfa0eb01e..19eb77470 100644 --- a/module/plugins/hoster/FreevideoCz.py +++ b/module/plugins/hoster/FreevideoCz.py @@ -37,7 +37,7 @@ class FreevideoCz(Hoster):      __name__ = "FreevideoCz"      __type__ = "hoster"      __pattern__ = r"http://www.freevideo.cz/vase-videa/(.*)\.html" -    __version__ = "0.1" +    __version__ = "0.2"      __description__ = """freevideo.cz"""      __author_name__ = ("zoidberg") @@ -53,7 +53,7 @@ class FreevideoCz(Hoster):          self.html = self.load(pyfile.url, decode=True)          if re.search(self.FILE_OFFLINE_PATTERN, self.html): -           self.offline() +            self.offline()          found = re.search(self.URL_PATTERN, self.html)          if found is None: self.fail("Parse error (URL)") @@ -61,4 +61,4 @@ class FreevideoCz(Hoster):          pyfile.name = re.search(self.__pattern__, pyfile.url).group(1) + ".mp4" -        self.download(download_url)
\ No newline at end of file +        self.download(download_url) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 977e97211..926781b40 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -4,6 +4,7 @@  from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo  from module.network.RequestFactory import getURL  import re +from time import strptime, mktime, gmtime  def getInfo(urls):      for url in urls: @@ -23,20 +24,17 @@ class FshareVn(SimpleHoster):      __name__ = "FshareVn"      __type__ = "hoster"      __pattern__ = r"http://(www\.)?fshare.vn/file/.*" -    __version__ = "0.13" +    __version__ = "0.16"      __description__ = """FshareVn Download Hoster"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz")      FILE_INFO_PATTERN = r'<p>(?P<N>[^<]+)<\\/p>[\\trn\s]*<p>(?P<S>[0-9,.]+)\s*(?P<U>[kKMG])i?B<\\/p>' -    FILE_OFFLINE_PATTERN = r'<div class=\\"f_left file_(enable|w)\\">' -    FILE_NAME_REPLACEMENTS = [("(.*)", doubleDecode)]  - -    DOWNLOAD_URL_PATTERN = r"<a class=\"bt_down\" id=\"down\".*window.location='([^']+)'\">" -    FORM_PATTERN = r'<form action="" method="post" name="frm_download">(.*?)</form>' -    FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' +    FILE_OFFLINE_PATTERN = r'<div class=\\"f_left file_w\\"|<\\/p>\\t\\t\\t\\t\\r\\n\\t\\t<p><\\/p>\\t\\t\\r\\n\\t\\t<p>0 KB<\\/p>' +    FILE_NAME_REPLACEMENTS = [("(.*)", doubleDecode)] +    DOWNLOAD_URL_PATTERN = r'action="(http://download.*?)[#"]'      VIP_URL_PATTERN = r'<form action="([^>]+)" method="get" name="frm_download">' -    WAIT_PATTERN = u"Vui lòng chờ lượt download kế tiếp" +    WAIT_PATTERN = ur'Lượt tải xuống kế tiếp là:\s*(.*?)\s*<'      def process(self, pyfile):          self.html = self.load('http://www.fshare.vn/check_link.php', post = { @@ -44,61 +42,65 @@ class FshareVn(SimpleHoster):              "arrlinks": pyfile.url              }, decode = True)          self.getFileInfo() -         -        url = self.handlePremium() if self.premium else self.handleFree() -        self.download(url) + +        if self.premium: +            self.handlePremium() +        else: +            self.handleFree()          self.checkDownloadedFile()      def handleFree(self):          self.html = self.load(self.pyfile.url, decode = True) -        if self.WAIT_PATTERN in self.html: -            self.retry(20, 300, "Try again later...") -             +          self.checkErrors() -        found = re.search(self.FORM_PATTERN, self.html, re.DOTALL) -        if not found: self.parseError('FORM') -        form = found.group(1) -        inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) +        action, inputs = self.parseHtmlForm('frm_download') +        self.url = self.pyfile.url + action + +        if not inputs: self.parseError('FORM') +        elif 'link_file_pwd_dl' in inputs: +            for password in self.getPassword().splitlines(): +                self.logInfo('Password protected link, trying "%s"' % password) +                inputs['link_file_pwd_dl'] = password +                self.html = self.load(self.url, post=inputs, decode=True) +                if not 'name="link_file_pwd_dl"' in self.html: +                    break +            else: +                self.fail("No or incorrect password") +        else: +            self.html = self.load(self.url, post=inputs, decode=True) -        self.html = self.load(self.pyfile.url, post = inputs, decode = True) +        self.checkErrors() -        if self.WAIT_PATTERN in self.html: -            self.retry(300, 20, "Try again later...") +        found = re.search(r'var count = (\d+)', self.html) +        self.setWait(int(found.group(1)) if found else 30)          found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) -        if not found: self.parseError('Free URL') -        url = found.group(1) +        if not found: self.parseError('FREE DL URL') +        self.url = found.group(1) +        self.logDebug("FREE DL URL: %s" % self.url) -        found = re.search(r'var count = (\d+)', self.html) -        self.setWait(int(found.group(1)) if found else 30)          self.wait() - -        return url +        self.download(self.url)      def handlePremium(self): -        header = self.load(self.pyfile.url, just_header = True) -        if 'location' in header and header['location'].startswith('http://download'): -            self.logDebug('Direct download') -            return self.pyfile.url -        else: -            self.html = self.load(self.pyfile.url) -             -            self.checkErrors() -             -            found = re.search(self.VIP_URL_PATTERN, self.html) -            if not found: -                if self.retries >= 3: self.resetAccount() -                self.account.relogin(self.user) -                self.retry(5, 1, 'VIP URL not found') -            url = found.group(1) -            self.logDebug('VIP URL: ' + url) -            return url -     +        self.download(self.pyfile.url) +      def checkErrors(self): -        if '/error.php?' in self.req.lastEffectiveURL: +        if '/error.php?' in self.req.lastEffectiveURL or u"Liên kết bạn chọn không tồn" in self.html:              self.offline() -     + +        found = re.search(self.WAIT_PATTERN, self.html) +        if found: +            self.logInfo("Wait until %s ICT" % found.group(1)) +            wait_until = mktime(strptime(found.group(1), "%d/%m/%Y %H:%M")) +            self.setWait(wait_until - mktime(gmtime()) - 7 * 3600, True) +            self.wait() +            self.retry() +        elif '<ul class="message-error">' in self.html: +            self.logError("Unknown error occured or wait time not parsed") +            self.retry(30, 120, "Unknown error") +      def checkDownloadedFile(self):          # check download          check = self.checkDownload({ @@ -106,4 +108,4 @@ class FshareVn(SimpleHoster):              })          if check == "not_found": -            self.fail("File not found on server")
\ No newline at end of file +            self.fail("File not found on server") diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 7c2af85ed..3bda3b32e 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -17,24 +17,75 @@      @author: jeix
      @author: mkaay
  """
 +from urlparse import urlparse, urljoin
 +from urllib import quote, unquote
 +import pycurl, re
  from module.plugins.Hoster import Hoster
 -
 +from module.network.HTTPRequest import BadHeader
  class Ftp(Hoster):
      __name__ = "Ftp"
 -    __version__ = "0.31"
 +    __version__ = "0.41"
      __pattern__ = r'(ftps?|sftp)://(.*?:.*?@)?.*?/.*' # ftp://user:password@ftp.server.org/path/to/file
      __type__ = "hoster"
      __description__ = """A Plugin that allows you to download from an from an ftp directory"""
 -    __author_name__ = ("jeix", "mkaay")
 -    __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de")
 +    __author_name__ = ("jeix", "mkaay", "zoidberg")
 +    __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
 -    def process(self, pyfile):
 -        pyfile.name = self.pyfile.url.rpartition('/')[2]
 -
 +    def setup(self):
          self.chunkLimit = -1
 -        self.resumeDownload = True
 -
 -        self.download(pyfile.url)
 -
 +        self.resumeDownload = True   
 +    
 +    def process(self, pyfile):
 +        parsed_url = urlparse(pyfile.url)
 +        netloc = parsed_url.netloc
 +        
 +        pyfile.name = parsed_url.path.rpartition('/')[2]
 +        try:
 +            pyfile.name = unquote(str(pyfile.name)).decode('utf8')
 +        except:
 +            pass        
 +        
 +        if not "@" in netloc:
 +            servers = [ x['login'] for x in self.account.getAllAccounts() ] if self.account else []                             
 +                
 +            if netloc in servers:
 +                self.logDebug("Logging on to %s" % netloc)                
 +                self.req.addAuth(self.account.accounts[netloc]["password"])
 +            else:
 +                for pwd in pyfile.package().password.splitlines(): 
 +                    if ":" in pwd:
 +                        self.req.addAuth(pwd.strip())
 +                        break                            
 +        
 +        self.req.http.c.setopt(pycurl.NOBODY, 1)
 +        
 +        try:
 +            response = self.load(pyfile.url)
 +        except pycurl.error, e:
 +            self.fail("Error %d: %s" % e.args)
 +        
 +        self.req.http.c.setopt(pycurl.NOBODY, 0)        
 +        self.logDebug(self.req.http.header)
 +        
 +        found = re.search(r"Content-Length:\s*(\d+)", response)
 +        if found:
 +            pyfile.size = int(found.group(1))                 
 +            self.download(pyfile.url)
 +        else:
 +            #Naive ftp directory listing          
 +            if re.search(r'^25\d.*?"', self.req.http.header, re.M):            
 +                pyfile.url = pyfile.url.rstrip('/')
 +                pkgname = "/".join((pyfile.package().name,urlparse(pyfile.url).path.rpartition('/')[2]))
 +                pyfile.url += '/'
 +                self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY
 +                response = self.load(pyfile.url, decode = False)
 +                links = [ pyfile.url + quote(x) for x in response.splitlines() ]
 +                self.logDebug("LINKS", links)
 +                self.core.api.addPackage(pkgname, links, 1)
 +                #self.core.files.addLinks(links, pyfile.package().id)
 +            else:
 +                self.fail("Unexpected server response")
 +            
 +        
\ No newline at end of file diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py new file mode 100644 index 000000000..34fda09d2 --- /dev/null +++ b/module/plugins/hoster/GamefrontCom.py @@ -0,0 +1,80 @@ +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL +from module.utils import parseFileSize + +class GamefrontCom(Hoster): +    __name__ = "GamefrontCom" +    __type__ = "hoster" +    __pattern__ = r"http://(?:\w*\.)*?gamefront.com/files/[A-Za-z0-9]+" +    __version__ = "0.02" +    __description__ = """gamefront.com hoster plugin""" +    __author_name__ = ("fwannmacher") +    __author_mail__ = ("felipe@warhammerproject.com") +     +    HOSTER_NAME = "gamefront.com" +    PATTERN_FILENAME = r'<title>(.*?) | Game Front' +    PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' +    PATTERN_OFFLINE = "This file doesn't exist, or has been removed." +     +    def setup(self): +        self.resumeDownload = True +        self.multiDL = False + +    def process(self, pyfile): +        self.pyfile = pyfile +        self.html = self.load(pyfile.url, decode=True) + +        if not self._checkOnline(): +            self.offline() +         +        self.pyfile.name = self._getName() +         +        self.link = self._getLink() +         +        if not self.link.startswith('http://'): +            self.link = "http://www.gamefront.com/" + self.link + +        self.download(self.link)          + +    def _checkOnline(self): +        if re.search(self.PATTERN_OFFLINE, self.html): +            return False +        else: +            return True +         +    def _getName(self): +        name = re.search(self.PATTERN_FILENAME, self.html) +        if name is None: +            self.fail("%s: Plugin broken." % self.__name__) + +        return name.group(1) +         +    def _getLink(self):  +        self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=[A-Za-z0-9]+)", self.html).group(1)) +        self.link = re.search("<a href=\"(http://media[0-9]+\.gamefront.com/.*)\">click here</a>", self.html2) + +        return self.link.group(1).replace("&", "&") + +def getInfo(urls): +    result = [] +     +    for url in urls:  +        html = getURL(url) +         +        if re.search(GamefrontCom.PATTERN_OFFLINE, html): +            result.append((url, 0, 1, url)) +        else: +            name = re.search(GamefrontCom.PATTERN_FILENAME, html) +             +            if name is None: +                result.append((url, 0, 1, url)) +                continue +                 +            name = name.group(1) +            size = re.search(GamefrontCom.PATTERN_FILESIZE, html) +            size = parseFileSize(size.group(1))  +             +            result.append((name, size, 3, url)) + +    yield result
\ No newline at end of file diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 0add79ed9..aa494e34e 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -17,28 +17,21 @@  """  import re -import datetime  from math import ceil  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.network.RequestFactory import getURL +  class HellshareCz(SimpleHoster):      __name__ = "HellshareCz"      __type__ = "hoster" -    __pattern__ = r"(http://(?:.*\.)*hellshare\.(?:cz|com|sk|hu)/[^?]*/\d+).*" -    __version__ = "0.77" -    __description__ = """Hellshare.cz""" +    __pattern__ = r"(http://(?:.*\.)*hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+).*" +    __version__ = "0.82" +    __description__ = """Hellshare.cz - premium only"""      __author_name__ = ("zoidberg") -    FREE_URL_PATTERN = r'<form[^>]*action="(http://free\d*\.helldata[^"]*)"' -    PREMIUM_URL_PATTERN = r"launchFullDownload\('([^']*)'\);" -    FILE_NAME_PATTERN = r'<h1 id="filename">(?P<N>[^<]+)</h1>' -    FILE_SIZE_PATTERN = r'<td><span>Size</span></td>\s*<th><span>(?P<S>[0-9.]*) (?P<U>[kKMG])i?B</span></th>' +    FILE_NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' +    FILE_SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[0-9.]*) (?P<U>[kKMG])i?B</strong>'      FILE_OFFLINE_PATTERN = r'<h1>File not found.</h1>' -    CAPTCHA_PATTERN = r'<img class="left" id="captcha-img"src="([^"]*)" />' -    #FILE_CREDITS_PATTERN = r'<strong class="filesize">(\d+) MB</strong>' -    CREDIT_LEFT_PATTERN = r'<p>After downloading this file you will have (\d+) MB for future downloads.' -    DOWNLOAD_AGAIN_PATTERN = r'<p>This file you downloaded already and re-download is for free. </p>'      SHOW_WINDOW_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"'      def setup(self): @@ -46,77 +39,18 @@ class HellshareCz(SimpleHoster):          self.chunkLimit = 1      def process(self, pyfile): +        if not self.account: self.fail("User not logged in")          pyfile.url = re.search(self.__pattern__, pyfile.url).group(1)          self.html = self.load(pyfile.url, decode = True)          self.getFileInfo() -        +        if not self.checkTrafficLeft(): +            self.fail("Not enough traffic left for user %s." % self.user) +          found = re.search(self.SHOW_WINDOW_PATTERN, self.html)          if not found: self.parseError('SHOW WINDOW') -        self.url = "http://www.hellshare.com" + found.group(1)         -        self.logDebug("SHOW WINDOW: " + self.url) -        self.html = self.load(self.url, decode=True) - -        if self.account: -            self.handlePremium() -        else: -            self.handleFree() - -    def handleFree(self): -        # hellshare is very generous -        if "You exceeded your today's limit for free download. You can download only 1 files per 24 hours." in self.html: -            t = datetime.datetime.today().replace(hour=1, minute=0, second=0) + datetime.timedelta( -                days=1) - datetime.datetime.today() -            self.setWait(t.seconds, True) -            self.wait() -            self.retry() - -        # parse free download url -        found = re.search(self.FREE_URL_PATTERN, self.html) -        if found is None: self.parseError("Free URL)") -        parsed_url = found.group(1) -        self.logDebug("Free URL: %s" % parsed_url) - -        # decrypt captcha -        found = re.search(self.CAPTCHA_PATTERN, self.html) -        if found is None: self.parseError("Captcha") -        captcha_url = found.group(1) - -        captcha = self.decryptCaptcha(captcha_url) -        self.logDebug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + captcha) -         -        self.download(parsed_url, post = {"captcha" : captcha, "submit" : "Download"}) - -        # check download -        check = self.checkDownload({ -            "wrong_captcha": re.compile(self.FREE_URL_PATTERN) -        }) - -        if check == "wrong_captcha": -            self.invalidCaptcha() -            self.retry() - -    def handlePremium(self): -        # get premium download url -        found = re.search(self.PREMIUM_URL_PATTERN, self.html) -        if found is None: self.fail("Parse error (URL)") -        download_url = found.group(1) - -        # check credit -        if self.DOWNLOAD_AGAIN_PATTERN in self.html: -            self.logInfo("Downloading again for free") -        else: -            found = re.search(self.CREDIT_LEFT_PATTERN, self.html) -            if not found: -                self.logError("Not enough credit left: %d (%d needed). Trying to download as free user." % (credits_left, file_credits)) -                self.resetAccount() -            credits_left = int(found.group(1)) - -            file_credits = ceil(self.pyfile.size / 1024 ** 2) -            self.logInfo("Downloading file for %d credits, %d credits left" % (file_credits, credits_left)) - -        self.download(download_url) +        self.url = "http://www.hellshare.com" + found.group(1) +        self.logDebug("DOWNLOAD URL: " + self.url) -        info = self.account.getAccountInfo(self.user, True) -        self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024)) +        self.download(self.url) -getInfo = create_getInfo(HellshareCz)
\ No newline at end of file +getInfo = create_getInfo(HellshareCz) diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index a03e2bf21..9858c82b7 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -22,15 +22,16 @@ 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.24" +    __pattern__ = r"http://(?:\w*\.)*(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj.pl)(/\S+/\d+)/?.*" +    __version__ = "0.27"      __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_SIZE_PATTERN = r'<span class="filesize right">(?P<S>[0-9.]+)\s*<span>(?P<U>[kKMG])i?B' +    FILE_NAME_PATTERN = r'<h1 title="(?P<N>.*?)"'      FILE_OFFLINE_PATTERN = r'<h2>(404 - Page|File) not found</h2>' -    FILE_URL_REPLACEMENTS = [(r"http://(?:\w*\.)*hellspy\.(?:cz|com|sk|hu)(/\S+/\d+)/?.*", r"http://www.hellspy.com\1")] +    FILE_URL_REPLACEMENTS = [(__pattern__, r"http://www.hellspy.com\1")]      CREDIT_LEFT_PATTERN = r'<strong>Credits: </strong>\s*(\d+)'      DOWNLOAD_AGAIN_PATTERN = r'<a id="button-download-start"[^>]*title="You can download the file without deducting your credit.">' diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index df652edcc..2caf1ffbc 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -13,7 +13,7 @@ def getInfo(urls):      for chunk in chunks(urls, 90):          api_param_file = {"action":"checklinks","links": ",".join(chunk),"fields":"id,status,name,size"} #api only supports old style links -        src = getURL(api_url_base, post=api_param_file) +        src = getURL(api_url_base, post=api_param_file, decode=True)          result = []          for i, res in enumerate(src.split("\n")):              if not res: @@ -31,8 +31,8 @@ def getInfo(urls):  class HotfileCom(Hoster):      __name__ = "HotfileCom"      __type__ = "hoster" -    __pattern__ = r"http://(www.)?hotfile\.com/dl/\d+/[0-9a-zA-Z]+/" -    __version__ = "0.34" +    __pattern__ = r"https?://(www.)?hotfile\.com/dl/\d+/[0-9a-zA-Z]+/" +    __version__ = "0.36"      __description__ = """Hotfile.com Download Hoster"""      __author_name__ = ("sitacuisses","spoob","mkaay","JoKoT3")      __author_mail__ = ("sitacuisses@yhoo.de","spoob@pyload.org","mkaay@mkaay.de","jokot3@gmail.com") @@ -66,14 +66,14 @@ class HotfileCom(Hoster):          args = {"links":self.pyfile.url, "fields":"id,status,name,size,sha1"}          resp = self.apiCall("checklinks", args) -        self.apiData = {} +        self.api_data = {}          for k, v in zip(args["fields"].split(","), resp.strip().split(",")): -            self.apiData[k] = v +            self.api_data[k] = v -        if self.apiData["status"] == "0": +        if self.api_data["status"] == "0":              self.offline() -        pyfile.name = self.apiData["name"] +        pyfile.name = self.api_data["name"]          if not self.premium:              self.downloadHTML() diff --git a/module/plugins/hoster/IFileWs.py b/module/plugins/hoster/IFileWs.py new file mode 100644 index 000000000..160fe641c --- /dev/null +++ b/module/plugins/hoster/IFileWs.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + + +class IFileWs(XFileSharingPro): +    __name__ = "IFileWs" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?ifile\.ws/\w+(/.+)?" +    __version__ = "0.01" +    __description__ = """Ifile.ws hoster plugin""" +    __author_name__ = ("z00nx") +    __author_mail__ = ("z00nx0@gmail.com") + +    FILE_INFO_PATTERN = '<h1\s+style="display:inline;">(?P<N>[^<]+)</h1>\s+\[(?P<S>[^]]+)\]' +    FILE_OFFLINE_PATTERN = 'File Not Found|The file was removed by administrator' +    HOSTER_NAME = "ifile.ws" +    LONG_WAIT_PATTERN = "(?P<M>\d(?=\s+minutes)).*(?P<S>\d+(?=\s+seconds))" + + +getInfo = create_getInfo(IFileWs) diff --git a/module/plugins/hoster/IcyFilesCom.py b/module/plugins/hoster/IcyFilesCom.py index 3f966d936..34737e560 100644 --- a/module/plugins/hoster/IcyFilesCom.py +++ b/module/plugins/hoster/IcyFilesCom.py @@ -42,7 +42,7 @@ class IcyFilesCom(Hoster):      __name__ = "IcyFilesCom"      __type__ = "hoster"      __pattern__ = r"http://(?:www\.)?icyfiles\.com/(.*)" -    __version__ = "0.04" +    __version__ = "0.05"      __description__ = """IcyFiles.com plugin - free only"""      __author_name__ = ("godofdream")      __author_mail__ = ("soilfiction@gmail.com") @@ -91,7 +91,7 @@ class IcyFilesCom(Hoster):          if found is None:              self.fail("Parse error (URL)")          download_url = "http://icyfiles.com/download.php?key=" + found.group(1) -	self.download(download_url) +        self.download(download_url)          # check download          check = self.checkDownload({              "notfound": re.compile(r"^<head><title>404 Not Found</title>$"), diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index a21cc748b..6accbc524 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -24,8 +24,8 @@ from module.network.RequestFactory import getURL  class IfolderRu(SimpleHoster):      __name__ = "IfolderRu"      __type__ = "hoster" -    __pattern__ = r"http://(?:[^.]*\.)?(?:ifolder.ru|rusfolder.com)/(?P<ID>\d+).*" -    __version__ = "0.36" +    __pattern__ = r"http://(?:[^.]*\.)?(?:ifolder\.ru|rusfolder\.(?:com|net|ru))/(?:files/)?(?P<ID>\d+).*" +    __version__ = "0.37"      __description__ = """rusfolder.com / ifolder.ru"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -50,7 +50,7 @@ class IfolderRu(SimpleHoster):          self.html = self.load("http://rusfolder.com/%s" % file_id, cookies=True, decode=True)          self.getFileInfo() -        url = "http://ints.rusfolder.com/ints/?rusfolder.com/%s?ints_code=" % file_id +        url = re.search('<a href="(http://ints\..*?=)"', self.html).group(1)          self.html = self.load(url, cookies=True, decode=True)          url, session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups() @@ -64,7 +64,7 @@ class IfolderRu(SimpleHoster):          captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id          for i in range(5): -            self.html = self.load(url, cookies=True)           +            self.html = self.load(url, cookies=True)              action, inputs = self.parseHtmlForm('ID="Form1"')              inputs['ints_session'] = re.search(self.INTS_SESSION_PATTERN, self.html).group(1)              inputs[re.search(self.HIDDEN_INPUT_PATTERN, self.html).group(1)] = '1' @@ -80,7 +80,7 @@ class IfolderRu(SimpleHoster):          else:              self.fail("Invalid captcha") -        self.html = self.load("http://rusfolder.com/%s?ints_code=%s" % (file_id, session_id), decode=True, cookies = True) +        #self.html = self.load("http://rusfolder.com/%s?ints_code=%s" % (file_id, session_id), decode=True, cookies = True)          download_url = re.search(self.DOWNLOAD_LINK_PATTERN, self.html).group(1)          self.correctCaptcha() diff --git a/module/plugins/hoster/KickloadCom.py b/module/plugins/hoster/KickloadCom.py deleted file mode 100644 index 9f1e5083d..000000000 --- a/module/plugins/hoster/KickloadCom.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import re - -from module.plugins.Hoster import Hoster - -class KickloadCom(Hoster): -    __name__ = "KickloadCom" -    __type__ = "hoster" -    __pattern__ = r"http://(?:www)?\.?(?:storage\.to|kickload\.com)/get/.*" -    __version__ = "0.2" -    __description__ = """Storage.to / Kickload.com Download Hoster""" -    __author_name__ = ("mkaay") - -    def setup(self): -        self.wantReconnect = False -        self.api_data = None -        self.html = None -        self.multiDL = False -         -    def process(self, pyfile): -        self.pyfile = pyfile -        self.prepare() -        self.download( self.get_file_url() ) -         -    def prepare(self): -        pyfile = self.pyfile -         -        self.wantReconnect = False - -        if not self.file_exists(): -            self.offline() - -        pyfile.name = self.get_file_name() -         -        self.setWait( self.get_wait_time() ) - -        while self.wantReconnect: -            self.wait() -            self.download_api_data() -            self.setWait(  self.get_wait_time() ) -         -        return True -     -    def download_html(self): -        url = self.pyfile.url -        self.html = self.load(url) - -    def download_api_data(self): -        url = self.pyfile.url -        info_url = url.replace("/get/", "/getlink/") -        src = self.load(info_url) -        if "To download this file you need a premium account" in src: -            self.fail("Need premium account for this file") -         -        pattern = re.compile(r"'(\w+)' : (.*?)[,|\}]") -        self.api_data = {} -        for pair in pattern.findall(src): -            self.api_data[pair[0]] = pair[1].strip("'") -        print self.api_data - -    def get_wait_time(self): -        if not self.api_data: -            self.download_api_data() -        if self.api_data["state"] == "wait": -            self.wantReconnect = True -        else: -            self.wantReconnect = False -             -        return int(self.api_data["countdown"]) + 3 -             -             - -    def file_exists(self): -        """ returns True or False -        """ -        if not self.api_data: -            self.download_api_data() -        if self.api_data["state"] == "failed": -            return False -        else: -            return True - -    def get_file_url(self): -        """ returns the absolute downloadable filepath -        """ -        if not self.api_data: -            self.download_api_data() -        return self.api_data["link"] - -    def get_file_name(self): -        if not self.html: -            self.download_html() -        file_name_pattern = r"<span class=\"orange\">Downloading:</span>(.*?)<span class=\"light\">(.*?)</span>" -        return re.search(file_name_pattern, self.html).group(1).strip() diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 88e708bf5..c63272f27 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -17,40 +17,44 @@  """  import re -from random import random  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo  from module.common.json_layer import json_loads +from module.plugins.ReCaptcha import ReCaptcha +  class LetitbitNet(SimpleHoster):      __name__ = "LetitbitNet"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)*(letitbit|shareflare).net/download/.*" -    __version__ = "0.19" +    __version__ = "0.20"      __description__ = """letitbit.net""" -    __author_name__ = ("zoidberg") -    __author_mail__ = ("zoidberg@mujmail.cz") +    __author_name__ = ("zoidberg", "z00nx") +    __author_mail__ = ("zoidberg@mujmail.cz", "z00nx0@gmail.com")      CHECK_URL_PATTERN = r"ajax_check_url\s*=\s*'((http://[^/]+)[^']+)';"      SECONDS_PATTERN = r"seconds\s*=\s*(\d+);" -     -    FILE_INFO_PATTERN = r'<h1[^>]*>File:.*?<span>(?P<N>[^<]+)</span>.*?\[<span>(?P<S>[^<]+)</span>]</h1>' +    CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P<value>[^']+)'" +    FILE_INFO_PATTERN = r'<span[^>]*>File:.*?<span[^>]*>(?P<N>[^&]+).*</span>.*?\[(?P<S>[^\]]+)\]</span>'      FILE_OFFLINE_PATTERN = r'>File not found<' -        +      DOMAIN = "http://letitbit.net"      FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] -     +    RECAPTCHA_KEY = "6Lc9zdMSAAAAAF-7s2wuQ-036pLRbM0p8dDaQdAM" +      def setup(self): -        self.resumeDownload = self.multiDL = True +        self.resumeDownload = True +        #TODO confirm that resume works      def handleFree(self):          action, inputs = self.parseHtmlForm('id="ifree_form"') -        if not action: self.parseError("page 1 / ifree_form") +        if not action: +            self.parseError("page 1 / ifree_form")          self.pyfile.size = float(inputs['sssize']) -        #self.logDebug(action, inputs) +        self.logDebug(action, inputs)          inputs['desc'] = "" -        self.html = self.load(self.DOMAIN + action, post = inputs, cookies = True) -         +        self.html = self.load(self.DOMAIN + action, post=inputs, cookies=True) +          """          action, inputs = self.parseHtmlForm('id="d3_form"')          if not action: self.parseError("page 2 / d3_form") @@ -68,35 +72,46 @@ class LetitbitNet(SimpleHoster):              self.logError(e)              self.parseError("page 3 / js")          """ -         -        found = re.search(self.SECONDS_PATTERN, self.html)       + +        found = re.search(self.SECONDS_PATTERN, self.html)          seconds = int(found.group(1)) if found else 60 -        self.setWait(seconds+1) +        self.logDebug("Seconds found", seconds) +        found = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) +        recaptcha_control_field = found.group(1) +        self.logDebug("ReCaptcha control field found", recaptcha_control_field) +        self.setWait(seconds + 1)          self.wait() -         -        response = self.load("%s/ajax/download3.php" % self.DOMAIN, post = " ", cookies = True) -        if response != '1': self.parseError('Unknown response - ajax_check_url') -         -        for i in range(5): -            captcha = self.decryptCaptcha('%s/captcha_new.php?rand=%d' % (self.DOMAIN, random() * 100000), cookies = True) -            response = self.load('%s/ajax/check_captcha.php' % self.DOMAIN, post = {"code": captcha}, cookies = True) -            self.logDebug(response) -            if not response: -                self.invalidCaptcha() -            elif response.startswith('['): -                urls = json_loads(response) -                break   -            elif response.startswith('http://'): -                urls = [response] -                break -            else: -                self.parseError("Unknown response - captcha check")              -                 + +        response = self.load("%s/ajax/download3.php" % self.DOMAIN, post=" ", cookies=True) +        if response != '1': +            self.parseError('Unknown response - ajax_check_url') +        self.logDebug(response) + +        recaptcha = ReCaptcha(self) +        challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) +        post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} +        self.logDebug("Post data to send", post_data) +        response = self.load('%s/ajax/check_recaptcha.php' % self.DOMAIN, post=post_data, cookies=True) +        self.logDebug(response) +        if not response: +            self.invalidCaptcha() +        if response == "error_free_download_blocked": +            self.logInfo("Daily limit reached, waiting 24 hours") +            self.setWait(24 * 60 * 60) +            self.wait() +        if response == "error_wrong_captcha": +            self.logInfo("Wrong Captcha") +            self.invalidCaptcha() +            self.retry() +        elif response.startswith('['): +            urls = json_loads(response) +        elif response.startswith('http://'): +            urls = [response]          else: -            self.fail("No valid captcha solution received") -         +            self.parseError("Unknown response - captcha check") +          self.correctCaptcha() -         +          for download_url in urls:              try:                  self.logDebug("Download URL", download_url) @@ -107,4 +122,4 @@ class LetitbitNet(SimpleHoster):          else:              self.fail("Download did not finish correctly") -getInfo = create_getInfo(LetitbitNet)
\ No newline at end of file +getInfo = create_getInfo(LetitbitNet) diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index 66bc6f407..babf354a9 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- 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 @@ -43,7 +43,7 @@ class LoadTo(Hoster):      __name__ = "LoadTo"      __type__ = "hoster"      __pattern__ = r"http://(www.*?\.)?load\.to/.{7,10}?/.*"  -    __version__ = "0.1002" +    __version__ = "0.11"      __description__ = """load.to"""      __author_name__ = ("halfman")      __author_mail__ = ("Pulpan3@gmail.com") @@ -79,4 +79,5 @@ class LoadTo(Hoster):              self.setWait(timmy.group(1))              self.wait() -        self.download(download_url) +        self.req.setOption("timeout", 120) +        self.download(download_url)
\ No newline at end of file diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py new file mode 100644 index 000000000..a1e866089 --- /dev/null +++ b/module/plugins/hoster/LuckyShareNet.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*-
 +
 +import re
 +from module.lib.bottle import json_loads
 +
 +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 +from module.plugins.ReCaptcha import ReCaptcha
 +
 +
 +class LuckyShareNet(SimpleHoster):
 +    __name__ = "LuckyShareNet"
 +    __type__ = "hoster"
 +    __pattern__ = r"https?://(www\.)?luckyshare.net/(?P<ID>\d{10,})"
 +    __version__ = "0.02"
 +    __description__ = """LuckyShare.net Download Hoster"""
 +    __author_name__ = ("stickell")
 +    __author_mail__ = ("l.stickell@yahoo.it")
 +
 +    FILE_INFO_PATTERN = r"<h1 class='file_name'>(?P<N>\S+)</h1>\s*<span class='file_size'>Filesize: (?P<S>[\d.]+)(?P<U>\w+)</span>"
 +    FILE_OFFLINE_PATTERN = 'There is no such file available'
 +    RECAPTCHA_KEY = '6LdivsgSAAAAANWh-d7rPE1mus4yVWuSQIJKIYNw'
 +
 +    def parseJson(self, rep):
 +        if 'AJAX Error' in rep:
 +            html = self.load(self.pyfile.url, decode=True)
 +            m = re.search(r"waitingtime = (\d+);", html)
 +            if m:
 +                waittime = int(m.group(1))
 +                self.logDebug('You have to wait %d seconds between free downloads' % waittime)
 +                self.retry(wait_time=waittime)
 +            else:
 +                self.parseError('Unable to detect wait time between free downloads')
 +        elif 'Hash expired' in rep:
 +            self.retry(reason='Hash expired')
 +        return json_loads(rep)
 +
 +    # TODO: There should be a filesize limit for free downloads
 +    # TODO: Some files could not be downloaded in free mode
 +    def handleFree(self):
 +        file_id = re.search(self.__pattern__, self.pyfile.url).group('ID')
 +        self.logDebug('File ID: ' + file_id)
 +        rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + file_id, decode=True)
 +        self.logDebug('JSON: ' + rep)
 +        json = self.parseJson(rep)
 +
 +        self.setWait(int(json['time']))
 +        self.wait()
 +
 +        recaptcha = ReCaptcha(self)
 +        for i in xrange(5):
 +            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
 +            rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" %
 +                            (challenge, response, json['hash']), decode=True)
 +            self.logDebug('JSON: ' + rep)
 +            if 'link' in rep:
 +                json.update(self.parseJson(rep))
 +                self.correctCaptcha()
 +                break
 +            elif 'Verification failed' in rep:
 +                self.logInfo('Wrong captcha')
 +                self.invalidCaptcha()
 +            else:
 +                self.parseError('Unable to get downlaod link')
 +
 +        if not json['link']:
 +            self.fail("No Download url retrieved/all captcha attempts failed")
 +
 +        self.logDebug('Direct URL: ' + json['link'])
 +        self.download(json['link'])
 +
 +
 +getInfo = create_getInfo(LuckyShareNet)
 diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 1069e5e1a..0e405930f 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -39,7 +39,7 @@ def checkHTMLHeader(url):                  elif 'content-disposition' in line:                      return url, 2              else: -               break +                break      except:          return url, 3 @@ -58,7 +58,7 @@ class MediafireCom(SimpleHoster):      __name__ = "MediafireCom"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)*mediafire\.com/(file/|(view/?|download.php)?\?)(\w{11}|\w{15})($|/)" -    __version__ = "0.77" +    __version__ = "0.78"      __description__ = """Mediafire.com plugin - free only"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -160,4 +160,4 @@ class MediafireCom(SimpleHoster):              else:                  break          else: -            self.fail("No valid recaptcha solution received")
\ No newline at end of file +            self.fail("No valid recaptcha solution received") diff --git a/module/plugins/hoster/MegaNz.py b/module/plugins/hoster/MegaNz.py new file mode 100644 index 000000000..a28ddca9d --- /dev/null +++ b/module/plugins/hoster/MegaNz.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- + +import re +import random +from array import array +from os import remove +from base64 import standard_b64decode + +from Crypto.Cipher import AES +from Crypto.Util import Counter + +from module.common.json_layer import json +from module.plugins.Hoster import Hoster + +#def getInfo(urls): +#    pass + +class MegaNz(Hoster): +    __name__ = "MegaNz" +    __type__ = "hoster" +    __pattern__ = r"https?://([a-z0-9]+\.)?mega\.co\.nz/#!([a-zA-Z0-9!_\-]+)" +    __version__ = "0.11" +    __description__ = """mega.co.nz hoster plugin""" +    __author_name__ = ("RaNaN", ) +    __author_mail__ = ("ranan@pyload.org", ) + +    API_URL = "https://g.api.mega.co.nz/cs?id=%d" +    FILE_SUFFIX = ".crypted" + +    def b64_decode(self, data): +        data = data.replace("-", "+").replace("_", "/") +        return standard_b64decode(data + '=' * (-len(data) % 4)) + +    def getCipherKey(self, key): +        """ Construct the cipher key from the given data """ +        a = array("I", key) +        key_array = array("I", [a[0] ^ a[4], a[1] ^a[5], a[2] ^ a[6], a[3] ^a[7]]) +        return key_array + +    def callApi(self, **kwargs): +        """ Dispatch a call to the api, see https://mega.co.nz/#developers """ +        # generate a session id, no idea where to obtain elsewhere +        uid = random.randint(10 << 9, 10 ** 10) + +        resp = self.load(self.API_URL % uid, post=json.dumps([kwargs])) +        self.logDebug("Api Response: " + resp) +        return json.loads(resp) + +    def decryptAttr(self, data, key): + +        cbc = AES.new(self.getCipherKey(key), AES.MODE_CBC, "\0" * 16) +        attr = cbc.decrypt(self.b64_decode(data)) +        self.logDebug("Decrypted Attr: " + attr) +        if not attr.startswith("MEGA"): +            self.fail(_("Decryption failed")) + +        # Data is padded, 0-bytes must be stripped +        return json.loads(attr.replace("MEGA", "").rstrip("\0").strip()) + +    def decryptFile(self, key): +        """  Decrypts the file at lastDownload` """ + +        # upper 64 bit of counter start +        n = key[16:24] + +        # convert counter to long and shift bytes +        ctr = Counter.new(128, initial_value=long(n.encode("hex"),16) << 64) +        cipher = AES.new(self.getCipherKey(key), AES.MODE_CTR, counter=ctr) + +        self.pyfile.setStatus("decrypting") +        f = open(self.lastDownload, "rb") +        df = open(self.lastDownload.rstrip(self.FILE_SUFFIX), "wb") + +        # TODO: calculate CBC-MAC for checksum + +        size = 2 ** 15 # buffer size, 32k +        while True: +            buf = f.read(size) +            if not buf: break + +            df.write(cipher.decrypt(buf)) + +        f.close() +        df.close() +        remove(self.lastDownload) + +    def process(self, pyfile): + +        key = None + +        # match is guaranteed because plugin was chosen to handle url +        node = re.search(self.__pattern__, pyfile.url).group(2) +        if "!" in node: +            node, key = node.split("!") + +        self.logDebug("File id: %s | Key: %s" % (node, key)) + +        if not key: +            self.fail(_("No file key provided in the URL")) + +        # g is for requesting a download url +        # this is similar to the calls in the mega js app, documentation is very bad +        dl = self.callApi(a="g", g=1, p=node, ssl=1)[0] + +        if "e" in dl: +            e = dl["e"] +            # ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later +            if e == -18: +                self.retry() +            else: +                self.fail(_("Error code:") + e) + +        # TODO: map other error codes, e.g +        # EACCESS (-11): Access violation (e.g., trying to write to a read-only share) + +        key = self.b64_decode(key) +        attr = self.decryptAttr(dl["at"], key) + +        pyfile.name = attr["n"] + self.FILE_SUFFIX + +        self.download(dl["g"]) +        self.decryptFile(key) + +        # Everything is finished and final name can be set +        pyfile.name = attr["n"] diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py deleted file mode 100644 index 8693e4303..000000000 --- a/module/plugins/hoster/MegauploadCom.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python
 -# -*- coding: utf-8 -*-
 -
 -import re
 -
 -from module.plugins.Hoster import Hoster
 -
 -from module.network.RequestFactory import getURL
 -
 -from module.utils import html_unescape
 -from datatypes.PyFile import statusMap
 -
 -def getInfo(urls):
 -    yield [(url, 0, 1, url) for url in urls]
 -
 -    
 -def _translateAPIFileInfo(apiFileId, apiFileDataMap, apiHosterMap):
 -    
 -    # Translate
 -    fileInfo = {}
 -    try:
 -        fileInfo['status'] = MegauploadCom.API_STATUS_MAPPING[apiFileDataMap[apiFileId]]
 -        fileInfo['name'] = html_unescape(apiFileDataMap['n'])
 -        fileInfo['size'] = int(apiFileDataMap['s'])
 -        fileInfo['hoster'] = apiHosterMap[apiFileDataMap['d']]        
 -    except:
 -        pass
 -
 -    return fileInfo
 -
 -class MegauploadCom(Hoster):
 -    __name__ = "MegauploadCom"
 -    __type__ = "hoster"
 -    __pattern__ = r"http://[\w\.]*?(megaupload)\.com/.*?(\?|&)d=(?P<id>[0-9A-Za-z]+)"
 -    __version__ = "0.32"
 -    __description__ = """Megaupload.com Download Hoster"""
 -    __author_name__ = ("spoob")
 -    __author_mail__ = ("spoob@pyload.org")
 -    
 -    API_URL = "http://megaupload.com/mgr_linkcheck.php"
 -    API_STATUS_MAPPING = {"0": statusMap['online'], "1": statusMap['offline'], "3": statusMap['temp. offline']}
 -    
 -    FILE_URL_PATTERN = r'<a href="([^"]+)" class="download_regular_usual"' 
 -    PREMIUM_URL_PATTERN = r'href=\"(http://[^\"]*?)\" class=\"download_premium_but\">'
 -    
 -    def init(self):
 -        self.html = [None, None]
 -        if self.account:
 -            self.premium = self.account.getAccountInfo(self.user)["premium"]
 -
 -        if not self.premium:
 -            self.multiDL = False
 -            self.chunkLimit = 1
 -
 -        self.api = {}
 -        
 -        self.fileID = re.search(self.__pattern__, self.pyfile.url).group("id")
 -        self.pyfile.url = "http://www.megaupload.com/?d=" + self.fileID
 -
 -        
 -    def process(self, pyfile):
 -        self.fail("Hoster not longer available")
 -
 -    def download_html(self):        
 -        for i in range(3):
 -            self.html[0] = self.load(self.pyfile.url)
 -            self.html[1] = self.html[0] # in case of no captcha, this already contains waiting time, etc
 -            count = 0
 -            if "The file that you're trying to download is larger than 1 GB" in self.html[0]:
 -                self.fail(_("You need premium to download files larger than 1 GB"))
 -                
 -            if re.search(r'<input[^>]*name="filepassword"', self.html[0]):
 -                pw = self.getPassword()
 -                if not pw:
 -                    self.fail(_("The file is password protected, enter a password and restart."))
 -
 -                self.html[1] = self.load(self.pyfile.url, post={"filepassword":pw})
 -                break # looks like there is no captcha for pw protected files
 -
 -            while "document.location='http://www.megaupload.com/?c=msg" in self.html[0]:
 -                # megaupload.com/?c=msg usually says: Please check back in 2 minutes,
 -                # so we can spare that http request
 -                self.setWait(120)
 -                if count > 1:
 -                    self.wantReconnect = True
 -
 -                self.wait()
 -                
 -                self.html[0] = self.load(self.pyfile.url)
 -                count += 1
 -                if count > 5:
 -                    self.fail(_("Megaupload is currently blocking your IP. Try again later, manually."))
 -            
 -            try:
 -                url_captcha_html = re.search('(http://[\w\.]*?megaupload\.com/gencap.php\?.*\.gif)', self.html[0]).group(1)
 -            except:
 -                continue
 -
 -            captcha = self.decryptCaptcha(url_captcha_html)
 -            captchacode = re.search('name="captchacode" value="(.*)"', self.html[0]).group(1)
 -            megavar = re.search('name="megavar" value="(.*)">', self.html[0]).group(1)
 -            self.html[1] = self.load(self.pyfile.url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar})
 -            if re.search(r"Waiting time before each download begins", self.html[1]) is not None:
 -                break
 -
 -    def download_api(self):
 -
 -        # MU API request 
 -        fileId = self.pyfile.url.split("=")[-1] # Get file id from url
 -        apiFileId = "id0"
 -        post = {apiFileId: fileId}
 -        response = getURL(self.API_URL, post=post, decode = True)    
 -        self.log.debug("%s: API response [%s]" % (self.__name__, response))
 -        
 -        # Translate API response
 -        parts = [re.split(r"&(?!amp;|#\d+;)", x) for x in re.split(r"&?(?=id[\d]+=)", response)]
 -        apiHosterMap = dict([elem.split('=') for elem in parts[0]])
 -        apiFileDataMap = dict([elem.split('=') for elem in parts[1]])        
 -        self.api = _translateAPIFileInfo(apiFileId, apiFileDataMap, apiHosterMap)
 -
 -        # File info
 -        try:
 -            self.pyfile.status = self.api['status']
 -            self.pyfile.name = self.api['name'] 
 -            self.pyfile.size = self.api['size']
 -        except KeyError:
 -            self.log.warn("%s: Cannot recover all file [%s] info from API response." % (self.__name__, fileId))
 -        
 -        # Fail if offline
 -        if self.pyfile.status == statusMap['offline']:
 -            self.offline()
 -
 -    def get_file_url(self):
 -        search = re.search(self.FILE_URL_PATTERN, self.html[1])
 -        return search.group(1).replace(" ", "%20") if search else None
 -
 -    def get_file_name(self):
 -        try:
 -            name =  self.api["name"]
 -        except KeyError:
 -            file_name_pattern = 'id="downloadlink"><a href="(.*)" onclick="'
 -            name = re.search(file_name_pattern, self.html[1]).group(1).split("/")[-1]
 -
 -        return html_unescape(name)
 -
 -    def get_wait_time(self):
 -        time = re.search(r"count=(\d+);", self.html[1])
 -        if time:
 -            return time.group(1)
 -        else:
 -            return 60
 -
 -    def file_exists(self):
 -        #self.download_html()
 -        if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) is not None or \
 -            re.search(r"Download limit exceeded", self.html[0]) is not None:
 -            return False
 -            
 -        if re.search("The file you are trying to access is temporarily unavailable", self.html[0]) is not None:
 -            self.setWait(120)
 -            self.log.debug("%s: The file is temporarily not available. Waiting 2 minutes." % self.__name__)
 -            self.wait()
 -            
 -            self.download_html()
 -            if re.search("The file you are trying to access is temporarily unavailable", self.html[0]) is not None:
 -                self.fail(_("Looks like the file is still not available. Retry downloading later, manually."))
 -            
 -        if re.search("The password you have entered is not correct", self.html[1]):
 -            self.fail(_("Wrong password for download link."))
 -            
 -        return True
 diff --git a/module/plugins/hoster/MegavideoCom.py b/module/plugins/hoster/MegavideoCom.py deleted file mode 100644 index fa5d87993..000000000 --- a/module/plugins/hoster/MegavideoCom.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import re -from time import time -from module.plugins.Hoster import Hoster -from module.unescape import unescape - -class MegavideoCom(Hoster): -    __name__ = "MegavideoCom" -    __type__ = "hoster" -    __pattern__ = r"http://(www\.)?megavideo.com/\?v=.*" -    __version__ = "0.2" -    __description__ = """Megavideo.com Download Hoster""" -    __author_name__ = ("jeix","mkaay") -    __author_mail__ = ("jeix@hasnomail.de","mkaay@mkaay.de") -         -    def setup(self): -        self.html = None -         -    def process(self, pyfile): -        self.pyfile = pyfile -         -        if not self.file_exists(): -            self.offline() -             -        self.pyfile.name = self.get_file_name() -        self.download( self.get_file_url() ) -         -    def download_html(self): -        url = self.pyfile.url -        self.html = self.req.load(url) - -    def get_file_url(self): -        """ returns the absolute downloadable filepath -        """ -        if self.html is None: -            self.download_html() - -        # get id -        id = re.search("previewplayer/\\?v=(.*?)&width", self.html).group(1) -         -        # check for hd link and return if there -        if "flashvars.hd = \"1\";" in self.html: -            content = self.req.load("http://www.megavideo.com/xml/videolink.php?v=%s" % id) -            return unescape(re.search("hd_url=\"(.*?)\"", content).group(1)) -             -        # else get normal link -        s = re.search("flashvars.s = \"(\\d+)\";", self.html).group(1) -        un = re.search("flashvars.un = \"(.*?)\";", self.html).group(1) -        k1 = re.search("flashvars.k1 = \"(\\d+)\";", self.html).group(1) -        k2 = re.search("flashvars.k2 = \"(\\d+)\";", self.html).group(1) -        return "http://www%s.megavideo.com/files/%s/" % (s, self.__decrypt(un, int(k1), int(k2))) -         -    def __decrypt(self, input, k1, k2): -        req1 = [] -        req3 = 0 -        for c in input: -            c = int(c, 16) -            tmp = "".join([str((c >> y) & 1) for y in range(4 -1, -1, -1)]) -            req1.extend([int(x) for x in tmp])             -         -        req6 = [] -        req3 = 0 -        while req3 < 384: -            k1 = (k1 * 11 + 77213) % 81371 -            k2 = (k2 * 17 + 92717) % 192811 -            req6.append((k1 + k2) % 128) -            req3 += 1 -             -        req3 = 256 -        while req3 >= 0: -            req5 = req6[req3] -            req4 = req3 % 128 -            req8 = req1[req5] -            req1[req5] = req1[req4] -            req1[req4] = req8 -            req3 -= 1 -             -        req3 = 0 -        while req3 < 128: -            req1[req3] = req1[req3] ^ (req6[req3+256] & 1) -            req3 += 1 -             -        out = "" -        req3 = 0 -        while req3 < len(req1): -            tmp = req1[req3] * 8 -            tmp += req1[req3+1] * 4 -            tmp += req1[req3+2] * 2 -            tmp += req1[req3+3] -             -            out += "%X" % tmp -             -            req3 += 4 -             -        return out.lower() -     -    def get_file_name(self): -        if self.html is None: -            self.download_html() -             -        name = re.search("flashvars.title = \"(.*?)\";", self.html).group(1) -        name = "%s.flv" % unescape(name.encode("ascii", "ignore")).decode("utf-8").encode("ascii", "ignore").replace("+", " ") -        return name - -    def file_exists(self): -        """ returns True or False -        """ -        if self.html is None: -            self.download_html() -             -        if re.search(r"Dieses Video ist nicht verfügbar.", self.html) is not None or \ -           re.search(r"This video is unavailable.", self.html) is not None: -            return False -        else: -            return True -             diff --git a/module/plugins/hoster/NahrajCz.py b/module/plugins/hoster/NahrajCz.py deleted file mode 100644 index 634c1af7d..000000000 --- a/module/plugins/hoster/NahrajCz.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- 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.Hoster import Hoster - -class NahrajCz(Hoster): -    __name__ = "NahrajCz" -    __type__ = "hoster" -    __pattern__ = r"http://.*nahraj.cz/content/download/.*" -    __version__ = "0.2" -    __description__ = """nahraj.cz""" -    __author_name__ = ("zoidberg") - -    FILE_URL_PATTERN = r'<form id="forwarder" method="post"[^>]*action="([^"]+/([^/"]+))">' -    SUBMIT_PATTERN = r'<input id="submit" type="submit" value="([^"]+)" name="submit"/>' -    #ERR_PATTERN = r'<p class="errorreport_error">Chyba: ([^<]+)</p>' - -    def setup(self): -        self.multiDL = False - -    def process(self, pyfile): -        self.html = self.load(pyfile.url) - -        found = re.search(self.FILE_URL_PATTERN, self.html) -        if found is None: -            self.fail("Parse error (URL)") -        parsed_url = found.group(1) -        pyfile.name = found.group(2) - -        found = re.search(self.SUBMIT_PATTERN, self.html) -        if found is None: -            self.fail("Parse error (SUBMIT)") -        submit = found.group(1) - -        self.download(parsed_url, disposition=True, post={ -            "submit": submit -        }) -        
\ No newline at end of file diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 9310b5c34..fd38be8c0 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -53,7 +53,7 @@ class NetloadIn(Hoster):      __name__ = "NetloadIn"      __type__ = "hoster"      __pattern__ = r"http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)" -    __version__ = "0.40" +    __version__ = "0.41"      __description__ = """Netload.in Download Hoster"""      __author_name__ = ("spoob", "RaNaN", "Gregy")      __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz") @@ -64,7 +64,7 @@ class NetloadIn(Hoster):              self.multiDL = True              self.chunkLimit = -1              self.resumeDownload = True -     +      def process(self, pyfile):          self.url = pyfile.url          self.prepare() @@ -92,7 +92,11 @@ class NetloadIn(Hoster):          id_regex = re.compile(self.__pattern__)          match = id_regex.search(url) -        if not match: +        if match: +            #normalize url +            self.url = 'http://www.netload.in/datei%s.htm' % match.group(1) +            self.logDebug("URL: %s" % self.url) +        else:              self.api_data = False              return @@ -105,7 +109,7 @@ class NetloadIn(Hoster):          self.log.debug("Netload: APIDATA: "+src)          self.api_data = {} -        if src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."): +        if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."):              lines = src.split(";")              self.api_data["exists"] = True              self.api_data["fileid"] = lines[0] diff --git a/module/plugins/hoster/NovafileCom.py b/module/plugins/hoster/NovafileCom.py new file mode 100644 index 000000000..dfd18761c --- /dev/null +++ b/module/plugins/hoster/NovafileCom.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class NovafileCom(XFileSharingPro): +    __name__ = "NovafileCom" +    __type__ = "hoster" +    __pattern__ = r"http://(?:\w*\.)*novafile\.com/\w{12}" +    __version__ = "0.01" +    __description__ = """novafile.com hoster plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +        +    FILE_SIZE_PATTERN = r'<div class="size">(?P<S>.+?)</div>' +    #FILE_OFFLINE_PATTERN = '<b>"File Not Found"</b>|File has been removed due to Copyright Claim' +    FORM_PATTERN = r'name="F\d+"' +    ERROR_PATTERN = r'class="alert[^"]*alert-separate"[^>]*>\s*(?:<p>)?(.*?)\s*</' +    DIRECT_LINK_PATTERN = r'<a href="(http://s\d+\.novafile\.com/.*?)" class="btn btn-green">Download File</a>' +     +    HOSTER_NAME = "novafile.com"    +     +    def setup(self): +        self.multiDL = False  + +getInfo = create_getInfo(NovafileCom)
\ No newline at end of file diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index fa699a278..126ca3d89 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -19,12 +19,13 @@  import re  from random import random  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.utils import fixup  class NowDownloadEu(SimpleHoster):      __name__ = "NowDownloadEu"      __type__ = "hoster"      __pattern__ = r"http://(www\.)?nowdownload\.(eu|co)/dl/(?P<ID>[a-z0-9]+)" -    __version__ = "0.01" +    __version__ = "0.02"      __description__ = """NowDownloadEu"""      __author_name__ = ("godofdream")      FILE_INFO_PATTERN = r'Downloading</span> <br> (?P<N>.*) (?P<S>[0-9,.]+) (?P<U>[kKMG])i?B </h4>' @@ -33,6 +34,9 @@ class NowDownloadEu(SimpleHoster):      FILE_CONTINUE_PATTERN = r'"(/dl2/[a-z0-9]+/[a-z0-9]+)"'      FILE_WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),'      FILE_DOWNLOAD_LINK = r'"(http://f\d+\.nowdownload\.eu/dl/[a-z0-9]+/[a-z0-9]+/[^<>"]*?)"' + +    FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')] +      def setup(self):          self.wantReconnect = False          self.multiDL = True @@ -59,4 +63,4 @@ class NowDownloadEu(SimpleHoster):          self.logDebug('Download link: ' + str(url.group(1)))          self.download(str(url.group(1)))         -getInfo = create_getInfo(NowDownloadEu)
\ No newline at end of file +getInfo = create_getInfo(NowDownloadEu) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 3a4ff7275..46323d829 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -7,10 +7,11 @@ class OneFichierCom(SimpleHoster):      __name__ = "OneFichierCom"      __type__ = "hoster"      __pattern__ = r"(http://(\w+)\.((1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl.fr))" -    __version__ = "0.44" +    __version__ = "0.45"      __description__ = """1fichier.com download hoster""" -    __author_name__ = ("fragonib", "the-razer", "zoidberg") -    __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz") +    __author_name__ = ("fragonib", "the-razer", "zoidberg","imclem") +    __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", +    "zoidberg@mujmail.cz","imclem on github")      FILE_NAME_PATTERN = r'">File name :</th>\s*<td>(?P<N>[^<]+)</td>'      FILE_SIZE_PATTERN = r'<th>File size :</th>\s*<td>(?P<S>[^<]+)</td>' @@ -19,8 +20,7 @@ class OneFichierCom(SimpleHoster):      DOWNLOAD_LINK_PATTERN = r'<br/> <br/> <br/> \s+<a href="(?P<url>http://.*?)"'             PASSWORD_PROTECTED_TOKEN = "protected by password" -    WAITING_PATTERN = "you must wait (\d+) minutes" -     +    WAITING_PATTERN = "Warning ! Without premium status, you can download only one file at a time and you must wait at least (\d+) minutes between each downloads."      def process(self, pyfile):          found = re.search(self.__pattern__, pyfile.url)          file_id = found.group(2)       diff --git a/module/plugins/hoster/OronCom.py b/module/plugins/hoster/OronCom.py deleted file mode 100755 index 864b7e96a..000000000 --- a/module/plugins/hoster/OronCom.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- coding: utf-8 -*- -import re - -from module.plugins.Hoster import Hoster -from module.network.RequestFactory import getURL -from module.plugins.ReCaptcha import ReCaptcha -from module.utils import parseFileSize - -def getInfo(urls): -    result = [] - -    for url in urls: -        html = getURL(url).replace("\n", "") -        html = html.replace("\t", "") -        if "File could not be found" in html: -            result.append((url, 0, 1, url)) -            continue - -        m = re.search(OronCom.FILE_INFO_PATTERN, html, re.MULTILINE) -        if m: -            name = m.group(1) -            size = parseFileSize(m.group(2), m.group(3)) -        else: -            name = url -            size = 0 - -        result.append((name, size, 2, url)) -    yield result - - -class OronCom(Hoster): -    __name__ = "OronCom" -    __type__ = "hoster" -    __pattern__ = r"http://(?:www.)?oron.com/(?!folder)\w+" -    __version__ = "0.16" -    __description__ = "Oron.com Hoster Plugin" -    __author_name__ = ("chrox", "DHMH") -    __author_mail__ = ("chrox@pyload.org", "webmaster@pcProfil.de") - -    FILE_INFO_PATTERN = r'(?:Filename|Dateiname): <b class="f_arial f_14px">(.*?)</b>\s*<br>\s*(?:Größe|File size): ([0-9,\.]+) (Kb|Mb|Gb)' - -    def init(self): -        self.resumeDownload = self.multiDL = True if self.account else False -        self.chunkLimit = 1 -        self.file_id = re.search(r'http://(?:www.)?oron.com/([a-zA-Z0-9]+)', self.pyfile.url).group(1) -        self.logDebug("File id is %s" % self.file_id) -        self.pyfile.url = "http://oron.com/" + self.file_id - -    def process(self, pyfile): -        #self.load("http://oron.com/?op=change_lang&lang=german") -        # already logged in, so the above line shouldn't be necessary -        self.html = self.load(self.pyfile.url, ref=False, decode=True).encode("utf-8").replace("\n", "") -        if "File could not be found" in self.html or "Datei nicht gefunden" in self.html or \ -                                        "This file has been blocked for TOS violation." in self.html: -            self.offline() -        self.html = self.html.replace("\t", "") -        m = re.search(self.FILE_INFO_PATTERN, self.html) -        if m: -            pyfile.name = m.group(1) -            pyfile.size = parseFileSize(m.group(2), m.group(3)) -            self.logDebug("File Size: %s" % pyfile.formatSize()) -        else: -            self.logDebug("Name and/or size not found.") - -        if self.account: -            self.handlePremium() -        else: -            self.handleFree() - -    def handleFree(self): -        #self.load("http://oron.com/?op=change_lang&lang=german") -        # already logged in, so the above line shouldn't be necessary -        self.html = self.load(self.pyfile.url, ref=False, decode=True).replace("\n", "") -        if "download1" in self.html: -            post_url = "http://oron.com/" + self.file_id -            post_dict = {'op': 'download1', -                         'usr_login': '', -                         'id': self.file_id, -                         'fname': self.pyfile.name, -                         'referer': '', -                         'method_free': ' Regular Download '} - -            self.html = self.load(post_url, post=post_dict, ref=False, decode=True).encode("utf-8") -            if '<p class="err">' in self.html: -                time_list = re.findall(r'\d+(?=\s[a-z]+,)|\d+(?=\s.*?until)', self.html) -                tInSec = 0 -                for t in time_list: -                    tInSec += int(t) * 60 ** (len(time_list) - time_list.index(t) - 1) -                self.setWait(tInSec, True) -                self.wait() -                self.retry() - -            if "download2" in self.html: -                post_dict['op'] = 'download2' -                post_dict['method_free'] = 'Regular Download' -                post_dict['method_premium'] = '' -                post_dict['down_direct'] = '1' -                post_dict['btn_download'] = ' Create Download Link ' -                del(post_dict['fname']) - -                re_captcha = ReCaptcha(self) -                downloadLink = None -                for i in range(5): -                    m = re.search('name="rand" value="(.*?)">', self.html) -                    post_dict['rand'] = m.group(1) -                    challengeId = re.search(r'/recaptcha/api/challenge[?k=]+([^"]+)', self.html) -                    challenge, result = re_captcha.challenge(challengeId.group(1)) -                    post_dict['recaptcha_challenge_field'] = challenge -                    post_dict['recaptcha_response_field'] = result -                    self.html = self.load(post_url, post=post_dict) -                    m = re.search('<p class="err">(.*?)</p>', self.html) -                    if m: -                        if m.group(1) == "Wrong captcha": -                            self.invalidCaptcha() -                            self.logDebug("Captcha failed") -                    if 'class="atitle">Download File' in self.html: -                        self.correctCaptcha() -                        downloadLink = re.search('href="(.*?)" class="atitle"', self.html) -                        break - -                if not downloadLink: -                    self.fail("Could not find download link") - -                self.logDebug("Download url found: %s" % downloadLink.group(1)) -                self.download(downloadLink.group(1)) -        else: -            self.logError("error in parsing site") - -    def handlePremium(self): -        info = self.account.getAccountInfo(self.user, True) -        self.logDebug("Traffic left: %s" % info['trafficleft']) -        self.logDebug("File Size: %d" % int(self.pyfile.size / 1024)) - -        if int(self.pyfile.size / 1024) > info["trafficleft"]: -            self.logInfo(_("Not enough traffic left")) -            self.account.empty(self.user) -            self.fail(_("Traffic exceeded")) - -        post_url = "http://oron.com/" + self.file_id -        m = re.search('name="rand" value="(.*?)">', self.html) -        rand = m.group(1) -        post_dict = {'down_direct': '1', 'id': self.file_id, 'op': 'download2', 'rand': rand, 'referer': '', -                     'method_free': '', 'method_premium': '1'} - -        self.html = self.load(post_url, post=post_dict, ref=False, decode=True).encode("utf-8") -        link = re.search('href="(.*?)" class="atitle"', self.html).group(1) -        self.download(link) diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 445627873..e1ed612b9 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -8,7 +8,7 @@ class PornhubCom(Hoster):      __name__ = "PornhubCom"
      __type__ = "hoster"
      __pattern__ = r'http://[\w\.]*?pornhub\.com/view_video\.php\?viewkey=[\w\d]+'
 -    __version__ = "0.4"
 +    __version__ = "0.5"
      __description__ = """Pornhub.com Download Hoster"""
      __author_name__ = ("jeix")
      __author_mail__ = ("jeix@hasnomail.de")
 @@ -61,7 +61,7 @@ class PornhubCom(Hoster):          match = re.search(r'<title[^>]+>([^<]+) - ', self.html)
          if match:
 -            name = re.group(1)
 +            name = match.group(1)
          else:
              matches = re.findall('<h1>(.*?)</h1>', self.html)
              if len(matches) > 1:
 diff --git a/module/plugins/hoster/Premium4Me.py b/module/plugins/hoster/Premium4Me.py index cd47a9e91..2679916e9 100644 --- a/module/plugins/hoster/Premium4Me.py +++ b/module/plugins/hoster/Premium4Me.py @@ -3,10 +3,13 @@  from urllib import quote
  from module.plugins.Hoster import Hoster
 +from module.utils import fs_encode
 +from os.path import exists
 +from os import remove
  class Premium4Me(Hoster):
      __name__ = "Premium4Me"
 -    __version__ = "0.10"
 +    __version__ = "0.04"
      __type__ = "hoster"
      __pattern__ = r"http://premium4.me/.*"
 @@ -55,4 +58,4 @@ class Premium4Me(Hoster):              traffic = int(self.load ("http://premium4.me/api/traffic.php?authcode=%s" % self.account.authcode))
          except:
              traffic = 0 
 -        return traffic       
\ No newline at end of file +        return traffic       
 diff --git a/module/plugins/hoster/PrzeklejPl.py b/module/plugins/hoster/PrzeklejPl.py deleted file mode 100644 index e97fb551e..000000000 --- a/module/plugins/hoster/PrzeklejPl.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- 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.Hoster import Hoster - -class PrzeklejPl(Hoster): -    __name__ = "PrzeklejPl" -    __type__ = "hoster" -    __pattern__ = r"http://.*przeklej.pl/plik/.*" -    __version__ = "0.1" -    __description__ = """przeklej.pl""" -    __author_name__ = ("zoidberg") - -    FILE_URL_PATTERN = r'<a href="([^"]+)" title="Pobierz plik">([^<]+)</a>' - -    #ERR_PATTERN = r'<p class="errorreport_error">Chyba: ([^<]+)</p>' - -    def setup(self): -        self.multiDL = True - -    def process(self, pyfile): -        self.html = self.load(pyfile.url, decode=True) - -        found = re.search(self.FILE_URL_PATTERN, self.html) -        if found is None: -            self.fail("Parse error (URL)") -        parsed_url = found.group(1) -        pyfile.name = found.group(2) - -        self.download("http://www.przeklej.pl" + parsed_url) -        
\ No newline at end of file diff --git a/module/plugins/hoster/PutlockerCom.py b/module/plugins/hoster/PutlockerCom.py index 8cfcd4d9e..ca5336231 100644 --- a/module/plugins/hoster/PutlockerCom.py +++ b/module/plugins/hoster/PutlockerCom.py @@ -52,7 +52,7 @@ class PutlockerCom(Hoster):      __name__ = "PutlockerCom"      __type__ = "hoster"      __pattern__ = r'http://(www\.)?putlocker\.com/(file|embed)/[A-Z0-9]+' -    __version__ = "0.2" +    __version__ = "0.21"      __description__ = """Putlocker.Com"""      __author_name__ = ("jeix") @@ -111,6 +111,9 @@ class PutlockerCom(Hoster):              self.link = re.search("\"(/get_file\\.php\\?download=[A-Z0-9]+\\&key=[a-z0-9]+&original=1)\"", self.html2)          if self.link is None: +            self.link = re.search("\"(/get_file\\.php\\?id=[A-Z0-9]+\\&key=[A-Za-z0-9=]+\\&original=1)\"", self.html2) +             +        if self.link is None:              self.link = re.search("playlist: \\'(/get_file\\.php\\?stream=[A-Za-z0-9=]+)\\'", self.html2)              if not self.link is None:                  self.html3 = self.load("http://www.putlocker.com" + self.link.group(1)) diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index ef33d3263..4932c4702 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -18,51 +18,82 @@  import re  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pycurl import FOLLOWLOCATION  class QuickshareCz(SimpleHoster):      __name__ = "QuickshareCz"      __type__ = "hoster"      __pattern__ = r"http://.*quickshare.cz/stahnout-soubor/.*" -    __version__ = "0.52" +    __version__ = "0.54"      __description__ = """Quickshare.cz"""      __author_name__ = ("zoidberg") -    VAR_PATTERN = r"var ID1 = '(?P<ID1>[^']+)';var ID2 = '(?P<ID2>[^']+)';var ID3 = '(?P<ID3>[^']+)';var ID4 = '(?P<ID4>[^']+)';var ID5 = '[^']*';var UU_prihlasen = '[^']*';var UU_kredit = [^;]*;var velikost = [^;]*;var kredit_odecet = [^;]*;var CaptchaText = '(?P<CaptchaText>[^']+)';var server = '(?P<Server>[^']+)';" -    FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>'      FILE_NAME_PATTERN = r'<th width="145px">Název:</th>\s*<td style="word-wrap:break-word;">(?P<N>[^<]+)</td>'      FILE_SIZE_PATTERN = r'<th>Velikost:</th>\s*<td>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</td>' - -    def setup(self): -        self.multiDL = False +    FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>'      def process(self, pyfile): -        self.html = self.load(pyfile.url, decode=True) +        self.html = self.load(pyfile.url, decode = True)          self.getFileInfo() - -        # parse the name from the site and set attribute in pyfile -        parsed_vars = re.search(self.VAR_PATTERN, self.html) -        if parsed_vars is None: self.parseError("VARs") -        pyfile.name = parsed_vars.group('ID3') - -        # download the file, destination is determined by pyLoad -        download_url = parsed_vars.group('Server') + "/download.php" -        self.log.debug("File:" + pyfile.name) -        self.log.debug("URL:" + download_url) - -        self.download(download_url, post={ -            "ID1": parsed_vars.group('ID1'), -            "ID2": parsed_vars.group('ID2'), -            "ID3": parsed_vars.group('ID3'), -            "ID4": parsed_vars.group('ID4') -        }) - -        # check download -        check = self.checkDownload({ -            "no_slots": "obsazen na 100 %" -        }) +        # parse js variables +        self.jsvars = dict((x, y.strip("'")) for x,y in re.findall(r"var (\w+) = ([0-9.]+|'[^']*')", self.html)) +        self.logDebug(self.jsvars)         +        pyfile.name = self.jsvars['ID3'] +         +        # determine download type - free or premium +        if self.premium: +            if 'UU_prihlasen' in self.jsvars: +                if self.jsvars['UU_prihlasen'] == '0': +                    self.logWarning('User not logged in') +                    self.relogin(self.user) +                    self.retry() +                elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']): +                    self.logWarning('Not enough credit left') +                    self.premium = False +                 +        if self.premium: +            self.handlePremium() +        else: +            self.handleFree() +             +        check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100) +        if check == "err": +            self.fail("File not found or plugin defect") +                    +    def handleFree(self):                +        # get download url +        download_url = '%s/download.php' % self.jsvars['server'] +        data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID3', 'ID4')) +        self.logDebug("FREE URL1:" + download_url, data) +                +        self.req.http.c.setopt(FOLLOWLOCATION, 0)         +        self.load(download_url, post=data) +        self.header = self.req.http.header         +        self.req.http.c.setopt(FOLLOWLOCATION, 1) +         +        found = re.search("Location\s*:\s*(.*)", self.header, re.I) +        if not found: self.fail('File not found') +        download_url = found.group(1)                         +        self.logDebug("FREE URL2:" + download_url) +         +        # check errors +        found = re.search(r'/chyba/(\d+)', download_url) +        if found: +            if found.group(1) == '1': +                self.retry(max_tries=60, wait_time=120, reason="This IP is already downloading") +            elif found.group(1) == '2': +                self.retry(max_tries=60, wait_time=60, reason="No free slots available") +            else: +                self.fail('Error %d' % found.group(1)) -        if check == "no_slots": -            self.retry(5, 600, "No free slots") +        # download file +        self.download(download_url)    +     +    def handlePremium(self): +        download_url = '%s/download_premium.php' % self.jsvars['server'] +        data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID4', 'ID5')) +        self.logDebug("PREMIUM URL:" + download_url, data) +        self.download(download_url, get=data) -create_getInfo(QuickshareCz)
\ No newline at end of file +getInfo = create_getInfo(QuickshareCz) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 678a3d707..1cc3ff8ae 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -21,90 +21,106 @@ from pycurl import HTTPHEADER  from random import random  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia, AdsCaptcha  from module.common.json_layer import json_loads -from module.plugins.ReCaptcha import ReCaptcha - -class AdsCaptcha(): -    def __init__(self, plugin): -        self.plugin = plugin -     -    def challenge(self, src): -        js = self.plugin.req.load(src, cookies=True) -         -        try: -            challenge = re.search("challenge: '(.*?)',", js).group(1) -            server = re.search("server: '(.*?)',", js).group(1) -        except: -            self.plugin.fail("adscaptcha error") -        result = self.result(server,challenge) -         -        return challenge, result - -    def result(self, server, challenge): -        return self.plugin.decryptCaptcha("%sChallenge.aspx" % server, get={"cid": challenge, "dummy": random()}, cookies=True, imgtype="jpg") - -class SolveMedia(): -    def __init__(self,plugin): -        self.plugin = plugin - -    def challenge(self, src): -        html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.script?k=%s" % src, cookies=True) -        try: -            ckey = re.search("ckey:.*?'(.*?)',",html).group(1) -            html = self.plugin.req.load("http://api.solvemedia.com/papi/_challenge.js?k=%s" % ckey, cookies=True) -            challenge = re.search('"chid".*?: "(.*?)"',html).group(1) -        except: -            self.plugin.fail("solvmedia error") -        result = self.result(challenge) -         -        return challenge, result - -    def result(self,challenge): -        return self.plugin.decryptCaptcha("http://api.solvemedia.com/papi/media?c=%s" % challenge,imgtype="gif") -         +from module.network.HTTPRequest import BadHeader  class RapidgatorNet(SimpleHoster):      __name__ = "RapidgatorNet"      __type__ = "hoster" -    __pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\d+)" -    __version__ = "0.06" +    __pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\w+)" +    __version__ = "0.16"      __description__ = """rapidgator.net"""      __author_name__ = ("zoidberg","chrox") -   + +    API_URL = 'http://rapidgator.net/api/file' +      FILE_INFO_PATTERN = r'Downloading:(\s*<[^>]*>)*\s*(?P<N>.*?)(\s*<[^>]*>)*\s*File size:\s*<strong>(?P<S>.*?)</strong>'      FILE_OFFLINE_PATTERN = r'<title>File not found</title>' -     -    JSVARS_PATTERN = r"\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*'?(.*?)'?;"  -    DOWNLOAD_LINK_PATTERN = r"location.href = '(.*?)'" + +    JSVARS_PATTERN = r"\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*'?(.*?)'?;" +    DOWNLOAD_LINK_PATTERN = r"location.href = '([^']+)';\s*}\s*return false;"      RECAPTCHA_KEY_PATTERN = r'"http://api.recaptcha.net/challenge?k=(.*?)"'      ADSCAPTCHA_SRC_PATTERN = r'(http://api.adscaptcha.com/Get.aspx[^"\']*)'      SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"' +     +    def setup(self): +        self.resumeDownload = False +        self.multiDL = False +        self.sid = None +        self.chunkLimit = 1 +        self.req.setOption("timeout", 120) +         +    def process(self, pyfile): +        if self.account:             +            self.sid = self.account.getAccountData(self.user).get('SID', None)  +        if self.sid: +            self.handlePremium() +        else: +            self.handleFree()             + +    def getAPIResponse(self, cmd): +        try: +            json = self.load('%s/%s' % (self.API_URL, cmd), +                             get = {'sid': self.sid, +                                    'url': self.pyfile.url}, decode = True) +            self.logDebug('API:%s' % cmd, json, "SID: %s" % self.sid) +            json = json_loads(json) +            status = json['response_status'] +            msg = json['response_details'] +        except BadHeader, e: +            self.logError('API:%s' % cmd, e, "SID: %s" % self.sid) +            status = e.code +            msg = e + +        if status == 200: +            return json['response'] +        elif status == 423: +            self.account.empty(self.user) +            self.retry() +        else: +            self.account.relogin(self.user) +            self.retry(wait_time=60) + +    def handlePremium(self): +        #self.logDebug("ACCOUNT_DATA", self.account.getAccountData(self.user)) +        self.api_data = self.getAPIResponse('info') +        self.api_data['md5'] = self.api_data['hash'] +        self.pyfile.name = self.api_data['filename'] +        self.pyfile.size = self.api_data['size'] +        url = self.getAPIResponse('download')['url'] +        self.multiDL = True +        self.download(url) +      def handleFree(self): +        self.html = self.load(self.pyfile.url, decode = True) +        self.getFileInfo() +              if "You can download files up to 500 MB in free mode" in self.html \          or "This file can be downloaded by premium only" in self.html:              self.fail("Premium account needed for download") -         -        self.checkWait()   -     + +        self.checkWait() +          jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html))          self.logDebug(jsvars) -         +          self.req.http.lastURL = self.pyfile.url          self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) -         -        url = "http://rapidgator.net%s?fid=%s" % (jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars["fid"])         + +        url = "http://rapidgator.net%s?fid=%s" % (jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars["fid"])          jsvars.update(self.getJsonResponse(url)) -         +          self.setWait(int(jsvars.get('secs', 30)) + 1, False)          self.wait() -         +          url = "http://rapidgator.net%s?sid=%s" % (jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars["sid"])          jsvars.update(self.getJsonResponse(url)) -         +          self.req.http.lastURL = self.pyfile.url          self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) -         +          url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha')          self.html = self.load(url)          found = re.search(self.ADSCAPTCHA_SRC_PATTERN, self.html) @@ -116,19 +132,15 @@ class RapidgatorNet(SimpleHoster):              if found:                  captcha_key = found.group(1)                  captcha = ReCaptcha(self) -                 +              else:                  found = re.search(self.SOLVEMEDIA_PATTERN, self.html)                  if found:                      captcha_key = found.group(1)                      captcha = SolveMedia(self)                  else: -                    self.parseError("Captcha:"+st) -        if captcha.__class__.__name__ == "SolveMedia": -            captcha_prov = "adcopy" -        else: -            captcha_prov = captcha.__class__.__name__.lower()         -         +                    self.parseError("Captcha") +          for i in range(5):              self.checkWait()              captcha_challenge, captcha_response = captcha.challenge(captcha_key) @@ -146,14 +158,14 @@ class RapidgatorNet(SimpleHoster):                  break          else:              self.fail("No valid captcha solution received") -             +          found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)          if not found:              self.parseError("download link")          download_url = found.group(1)          self.logDebug(download_url)          self.download(download_url) -     +      def checkWait(self):          found = re.search(r"(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|min)", self.html)          if found: @@ -164,18 +176,17 @@ class RapidgatorNet(SimpleHoster):                  wait_time = 60              else:                  return -         +          self.logDebug("Waiting %d minutes" % wait_time)          self.setWait(wait_time * 60, True)          self.wait()          self.retry(max_tries = 24) -     +      def getJsonResponse(self, url):          response = self.load(url, decode = True)          if not response.startswith('{'): -            self.retry()         +            self.retry()          self.logDebug(url, response) -        return json_loads(response)         +        return json_loads(response)  getInfo = create_getInfo(RapidgatorNet) - diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py index 8339d40eb..7c5543cc8 100644 --- a/module/plugins/hoster/RarefileNet.py +++ b/module/plugins/hoster/RarefileNet.py @@ -7,13 +7,17 @@ class RarefileNet(XFileSharingPro):      __name__ = "RarefileNet"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)*rarefile.net/\w{12}" -    __version__ = "0.01" +    __version__ = "0.02"      __description__ = """Rarefile.net hoster plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz")      FILE_NAME_PATTERN = r'<td><font color="red">(?P<N>.*?)</font></td>'      FILE_SIZE_PATTERN = r'<td>Size : (?P<S>.+?) ' +    HOSTER_NAME = "rarefile.net" +     +    def setup(self): +        self.resumeDownload = self.multiDL = self.premium       def handleCaptcha(self, inputs):          captcha_div = re.search(r'<b>Enter code.*?<div.*?>(.*?)</div>', self.html, re.S).group(1) diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 370adf077..141dcb8c8 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -6,9 +6,8 @@ from module.plugins.Hoster import Hoster  class RehostTo(Hoster):      __name__ = "RehostTo" -    __version__ = "0.1" +    __version__ = "0.11"      __type__ = "hoster" -      __pattern__ = r"https?://.*rehost.to\..*"      __description__ = """rehost.com hoster plugin"""      __author_name__ = ("RaNaN") @@ -18,7 +17,7 @@ class RehostTo(Hoster):          return unquote(url.rsplit("/", 1)[1])      def setup(self): -        self.chunkLimit = 3 +        self.chunkLimit = 1          self.resumeDownload = True      def process(self, pyfile): diff --git a/module/plugins/hoster/ReloadCc.py b/module/plugins/hoster/ReloadCc.py new file mode 100644 index 000000000..7dc6d9bb6 --- /dev/null +++ b/module/plugins/hoster/ReloadCc.py @@ -0,0 +1,103 @@ +from module.plugins.Hoster    import Hoster + +from module.common.json_layer import json_loads + +from module.network.HTTPRequest import BadHeader + +class ReloadCc(Hoster): +    __name__ = "ReloadCc" +    __version__ = "0.4" +    __type__ = "hoster" +    __description__ = """Reload.Cc hoster plugin""" + +    # Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady create the regex patterns for us using getHosters in our ReloadCc hook. +    __pattern__ = None + +    __author_name__ = ("Reload Team") +    __author_mail__ = ("hello@reload.cc") + +    def process(self, pyfile): +        # Check account +        if not self.account or not self.account.canUse(): +            self.logError("Please enter a valid reload.cc account or deactivate this plugin") +            self.fail("No valid reload.cc account provided") + +        # In some cases hostsers do not supply us with a filename at download, so we are going to set a fall back filename (e.g. for freakshare or xfileshare) +        self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash + +        # Correction for automatic assigned filename: Removing html at end if needed +        suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] +        temp = self.pyfile.name.split('.') +        if temp.pop() in suffix_to_remove: +            self.pyfile.name = ".".join(temp) + +        # Get account data +        (user, data) = self.account.selectAccount() + +        query_params = dict( +            via='pyload', +            v=1, +            user=user, +            uri=self.pyfile.url +        ) + +        try: +            query_params.update(dict(hash=self.account.infos[user]['pwdhash'])) +        except Exception: +            query_params.update(dict(pwd=data['password'])) + +        try: +            answer = self.load("http://api.reload.cc/dl", get=query_params) +        except BadHeader, e: +            if e.code == 400: +                self.fail("The URI is not supported by Reload.cc.") +            elif e.code == 401: +                self.fail("Wrong username or password") +            elif e.code == 402: +                self.fail("Your account is inactive. A payment is required for downloading!") +            elif e.code == 403: +                self.fail("Your account is disabled. Please contact the Reload.cc support!") +            elif e.code == 409: +                self.logWarning("The hoster seems to be a limited hoster and you've used your daily traffic for this hoster: %s" % self.pyfile.url) +                # Wait for 6 hours and retry up to 4 times => one day +                self.retry(max_retries=4, wait_time=(3600 * 6), reason="Limited hoster traffic limit exceeded") +            elif e.code == 429: +                self.retry(max_retries=5, wait_time=120, reason="Too many concurrent connections") # Too many connections, wait 2 minutes and try again +            elif e.code == 503: +                self.retry(wait_time=600, reason="Reload.cc is currently in maintenance mode! Please check again later.") # Retry in 10 minutes +            else: +                self.fail("Internal error within Reload.cc. Please contact the Reload.cc support for further information.") +            return + +        data = json_loads(answer) + +        # Check status and decide what to do +        status = data.get('status', None) +        if status == "ok": +            conn_limit = data.get('msg', 0) +            # API says these connections are limited +            # Make sure this limit is used - the download will fail if not +            if conn_limit > 0: +                try: +                    self.limitDL = int(conn_limit) +                except ValueError: +                    self.limitDL = 1 +            else: +                self.limitDL = 0 + +            try: +                self.download(data['link'], disposition=True) +            except BadHeader, e: +                if e.code == 404: +                    self.fail("File Not Found") +                elif e.code == 412: +                    self.fail("File access password is wrong") +                elif e.code == 417: +                    self.fail("Password required for file access") +                elif e.code == 429: +                    self.retry(max_retries=5, wait_time=120, reason="Too many concurrent connections") # Too many connections, wait 2 minutes and try again +                else: +                    self.fail("Internal error within Reload.cc. Please contact the Reload.cc support for further information.") +                return +        else: +            self.fail("Internal error within Reload.cc. Please contact the Reload.cc support for further information.") diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py index b3d7bafc6..c2ff54e0c 100644 --- a/module/plugins/hoster/RyushareCom.py +++ b/module/plugins/hoster/RyushareCom.py @@ -1,18 +1,53 @@  # -*- coding: utf-8 -*-  from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo +import re +  class RyushareCom(XFileSharingPro):      __name__ = "RyushareCom"      __type__ = "hoster" -    __pattern__ = r"http://(?:\w*\.)*?ryushare.com/\w{12}" -    __version__ = "0.02" +    __pattern__ = r"http://(?:\w*\.)*?ryushare.com/\w{11,}" +    __version__ = "0.10"      __description__ = """ryushare.com hoster plugin""" -    __author_name__ = ("zoidberg") -    __author_mail__ = ("zoidberg@mujmail.cz") -     +    __author_name__ = ("zoidberg", "stickell") +    __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") +      HOSTER_NAME = "ryushare.com" -     + +    WAIT_PATTERN = r'(?:You have to|Please) wait (?:(?P<min>\d+) minutes, )?(?:<span id="[^"]+">)?(?P<sec>\d+)(?:</span>)? seconds' +    DIRECT_LINK_PATTERN = r'<a href="([^"]+)">Click here to download</a>' +      def setup(self):          self.resumeDownload = self.multiDL = self.premium +        # Up to 3 chunks allowed in free downloads. Unknown for premium +        self.chunkLimit = 3 + +    def getDownloadLink(self): +        self.html = self.load(self.pyfile.url) +        action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) +        if inputs.has_key('method_premium'): +            del inputs['method_premium'] + +        self.html = self.load(self.pyfile.url, post = inputs) +        action, inputs = self.parseHtmlForm('F1') + +        for i in xrange(10): +            self.logInfo('Attempt to detect direct link #%d' % i) + +            # Wait +            if 'You have reached the download-limit!!!' in self.html: +                self.setWait(3600, True) +            else: +                m = re.search(self.WAIT_PATTERN, self.html).groupdict('0') +                waittime = int(m['min']) * 60 + int(m['sec']) +                self.setWait(waittime) +            self.wait() + +            self.html = self.load(self.pyfile.url, post = inputs) +            if 'Click here to download' in self.html: +                m = re.search(self.DIRECT_LINK_PATTERN, self.html) +                return m.group(1) + +        self.parseError('No direct link within 10 retries') -getInfo = create_getInfo(RyushareCom)
\ No newline at end of file +getInfo = create_getInfo(RyushareCom) diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py new file mode 100644 index 000000000..b9a900d96 --- /dev/null +++ b/module/plugins/hoster/SecureUploadEu.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + + +class SecureUploadEu(XFileSharingPro): +    __name__ = "SecureUploadEu" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?secureupload\.eu/(\w){12}(/\w+)" +    __version__ = "0.01" +    __description__ = """SecureUpload.eu hoster plugin""" +    __author_name__ = ("z00nx") +    __author_mail__ = ("z00nx0@gmail.com") + +    HOSTER_NAME = "secureupload.eu" +    FILE_INFO_PATTERN = '<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>' +    FILE_OFFLINE_PATTERN = 'The file was removed|File Not Found' + +getInfo = create_getInfo(SecureUploadEu) diff --git a/module/plugins/hoster/SendmywayCom.py b/module/plugins/hoster/SendmywayCom.py new file mode 100644 index 000000000..fcbac850a --- /dev/null +++ b/module/plugins/hoster/SendmywayCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + + +class SendmywayCom(XFileSharingPro): +    __name__ = "SendmywayCom" +    __type__ = "hoster" +    __pattern__ = r"http://(?:\w*\.)*?sendmyway.com/\w{12}" +    __version__ = "0.01" +    __description__ = """SendMyWay hoster plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") + +    FILE_NAME_PATTERN = r'<p class="file-name" ><.*?>\s*(?P<N>.+)' +    FILE_SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>' +    HOSTER_NAME = "sendmyway.com" + +getInfo = create_getInfo(SendmywayCom) diff --git a/module/plugins/hoster/Share76Com.py b/module/plugins/hoster/Share76Com.py new file mode 100644 index 000000000..db850cb73 --- /dev/null +++ b/module/plugins/hoster/Share76Com.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class Share76Com(XFileSharingPro): +    __name__ = "Share76Com" +    __type__ = "hoster" +    __pattern__ = r"http://(?:\w*\.)*?share76.com/\w{12}" +    __version__ = "0.03" +    __description__ = """share76.com hoster plugin""" +    __author_name__ = ("me") + +    FILE_INFO_PATTERN = r'<h2>\s*File:\s*<font[^>]*>(?P<N>[^>]+)</font>\s*\[<font[^>]*>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</font>\]</h2>' +    HOSTER_NAME = "share76.com" + +    def setup(self): +        self.resumeDownload = self.multiDL = self.premium +        self.chunkLimit = 1 + +getInfo = create_getInfo(Share76Com) diff --git a/module/plugins/hoster/ShareFilesCo.py b/module/plugins/hoster/ShareFilesCo.py new file mode 100644 index 000000000..ee44b0a1f --- /dev/null +++ b/module/plugins/hoster/ShareFilesCo.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo +import re + +class ShareFilesCo(XFileSharingPro): +    __name__ = "ShareFilesCo" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?sharefiles\.co/\w{12}" +    __version__ = "0.01" +    __description__ = """Sharefiles.co hoster plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    HOSTER_NAME = "sharefiles.co" + +    def startDownload(self, link): +        link = link.strip() +        if link.startswith('http://adf.ly'): +            link = re.sub('http://adf.ly/\d+/', '', link) +        if self.captcha: self.correctCaptcha() +        self.logDebug('DIRECT LINK: %s' % link) +        self.download(link) + +getInfo = create_getInfo(ShareFilesCo) diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index 4a25d4027..5a08fed1f 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -9,8 +9,6 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo  from module.common.json_layer import json_loads  def checkFile(url):     -    info = {"name" : url, "size" : 0, "status" : 3} -          response = getURL("http://share-rapid.com/checkfiles.php", post = {"files": url}, decode = True)      info = json_loads(response) @@ -44,8 +42,8 @@ def getInfo(urls):  class ShareRapidCom(SimpleHoster):      __name__ = "ShareRapidCom"      __type__ = "hoster" -    __pattern__ = r"http://(?:www\.)?((share(-?rapid\.(biz|com|cz|info|eu|net|org|pl|sk)|-(central|credit|free|net)\.cz|-ms\.net)|(s-?rapid|rapids)\.(cz|sk))|(e-stahuj|mediatack|premium-rapidshare|rapidshare-premium|qiuck)\.cz|kadzet\.com|stahuj-zdarma\.eu|strelci\.net|universal-share\.com)/stahuj/(.+)" -    __version__ = "0.50" +    __pattern__ = r"http://(?:www\.)?((share(-?rapid\.(biz|com|cz|info|eu|net|org|pl|sk)|-(central|credit|free|net)\.cz|-ms\.net)|(s-?rapid|rapids)\.(cz|sk))|(e-stahuj|mediatack|premium-rapidshare|rapidshare-premium|qiuck)\.cz|kadzet\.com|stahuj-zdarma\.eu|strelci\.net|universal-share\.com)/stahuj/(\w+)" +    __version__ = "0.52"      __description__ = """Share-rapid.com plugin - premium only"""      __author_name__ = ("MikyWoW", "zoidberg")      __author_mail__ = ("MikyWoW@seznam.cz", "zoidberg@mujmail.cz") @@ -57,6 +55,8 @@ class ShareRapidCom(SimpleHoster):      DOWNLOAD_URL_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>'      ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům'      ERR_CREDIT_PATTERN = ur'<div class="error_div"><strong>Stahování zdarma je možné jen přes náš' +     +    FILE_URL_REPLACEMENTS = [(__pattern__, r'http://share-rapid.com/stahuj/\1')]      def setup(self):          self.chunkLimit = 1 @@ -101,4 +101,4 @@ class ShareRapidCom(SimpleHoster):              elif re.search(self.ERR_CREDIT_PATTERN, self.html):                  self.fail("Not enough credit left")              else: -                self.fail("Download link not found")           
\ No newline at end of file +                self.fail("Download link not found")            diff --git a/module/plugins/hoster/SharebeesCom.py b/module/plugins/hoster/SharebeesCom.py new file mode 100644 index 000000000..f5bacc5b0 --- /dev/null +++ b/module/plugins/hoster/SharebeesCom.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + + +class SharebeesCom(XFileSharingPro): +    __name__ = "SharebeesCom" +    __type__ = "hoster" +    __pattern__ = r"http://(?:\w*\.)*?sharebees.com/\w{12}" +    __version__ = "0.01" +    __description__ = """ShareBees hoster plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") + +    FILE_NAME_PATTERN = r'<p class="file-name" ><.*?>\s*(?P<N>.+)' +    FILE_SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>' +    FORM_PATTERN = 'F1' +    HOSTER_NAME = "sharebees.com" + +getInfo = create_getInfo(SharebeesCom) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index e47aa0e5e..e1867168b 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -17,7 +17,7 @@ def getInfo(urls):      for chunk in chunks(urls, 90):          api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/","").rstrip("/") for x in chunk)} #api only supports old style links -        src = getURL(api_url_base, post=api_param_file) +        src = getURL(api_url_base, post=api_param_file, decode=True)          result = []          for i, res in enumerate(src.split("\n")):              if not res: @@ -43,7 +43,7 @@ class ShareonlineBiz(Hoster):      __name__ = "ShareonlineBiz"      __type__ = "hoster"      __pattern__ = r"http://[\w\.]*?(share\-online\.biz|egoshare\.com)/(download.php\?id\=|dl/)[\w]+" -    __version__ = "0.34" +    __version__ = "0.36"      __description__ = """Shareonline.biz Download Hoster"""      __author_name__ = ("spoob", "mkaay", "zoidberg")      __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz") @@ -57,7 +57,8 @@ class ShareonlineBiz(Hoster):          self.file_id = re.search(r"(id\=|/dl/)([a-zA-Z0-9]+)", self.pyfile.url).group(2)          self.pyfile.url = "http://www.share-online.biz/dl/" + self.file_id -        self.resumeDownload = self.multiDL = self.premium +        self.resumeDownload = self.premium +        self.multiDL = False          #self.chunkLimit = 1          self.check_data = None @@ -84,7 +85,7 @@ class ShareonlineBiz(Hoster):      def downloadAPIData(self):          api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1"          api_param_file = {"links": self.pyfile.url.replace("http://www.share-online.biz/dl/","")} #api only supports old style links -        src = self.load(api_url_base, cookies=False, post=api_param_file) +        src = self.load(api_url_base, cookies=False, post=api_param_file, decode=True)          fields = src.split(";")          self.api_data = {"fileid": fields[0], @@ -139,7 +140,6 @@ class ShareonlineBiz(Hoster):              self.retry(5, 60, "Cookie failure")          elif check == "fail":              self.retry(5, 300, "Download failed") -              def checkErrors(self):          found = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) @@ -165,7 +165,9 @@ class ShareonlineBiz(Hoster):      def handleAPIPremium(self): #should be working better                                  self.account.getAccountInfo(self.user, True) -        src = self.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=download&lid=%s" % (self.user, self.account.accounts[self.user]["password"], self.file_id), post={}) +        src = self.load("http://api.share-online.biz/account.php", +            {"username": self.user, "password": self.account.accounts[self.user]["password"], "act": "download", "lid": self.file_id}) +          self.api_data = dlinfo = {}          for line in src.splitlines():              key, value = line.split(": ") @@ -182,6 +184,7 @@ class ShareonlineBiz(Hoster):          if dlLink == "server_under_maintenance":              self.tempoffline()          else: +            self.multiDL = True              self.download(dlLink)      def checksum(self, local_file): diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py new file mode 100644 index 000000000..7f0dee0e5 --- /dev/null +++ b/module/plugins/hoster/ShareplaceCom.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python
 +# -*- coding: utf-8 -*-
 +
 +import re
 +import urllib
 +from module.plugins.Hoster import Hoster
 +
 +class ShareplaceCom(Hoster):
 +    __name__ = "ShareplaceCom"
 +    __type__ = "hoster"
 +    __pattern__ = r"(http://)?(www\.)?shareplace\.(com|org)/\?[a-zA-Z0-9]+"
 +    __version__ = "0.1"
 +    __description__ = """Shareplace.com Download Hoster"""
 +    __author_name__ = ("ACCakut, based on YourfilesTo by jeix and skydancer")
 +    __author_mail__ = ("none")
 +
 +    def setup(self):
 +        self.html = None
 +        self.multiDL = True
 +
 +    def process(self,pyfile):
 +        self.pyfile = pyfile
 +        self.prepare()
 +        self.download(self.get_file_url())
 +    
 +    def prepare(self):
 +        if not self.file_exists():
 +            self.offline()
 +
 +        self.pyfile.name = self.get_file_name()
 +        
 +        wait_time = self.get_waiting_time()
 +        self.setWait(wait_time)
 +        self.log.debug("%s: Waiting %d seconds." % (self.__name__,wait_time))
 +        self.wait()
 +
 +    def get_waiting_time(self):
 +        if self.html is None:
 +            self.download_html()
 +            
 +        #var zzipitime = 15;
 +        m = re.search(r'var zzipitime = (\d+);', self.html)
 +        if m:
 +            sec = int(m.group(1))
 +        else:
 +            sec = 0
 +            
 +        return sec
 +        
 +    def download_html(self):
 +        url = re.sub("shareplace.com\/\?", "shareplace.com//index1.php/?a=", self.pyfile.url)
 +        self.html = self.load(url, decode=True)
 +
 +    def get_file_url(self):
 +        """ returns the absolute downloadable filepath
 +        """
 +        url = re.search(r"var beer = '(.*?)';", self.html)
 +        if url:
 +            url = url.group(1)
 +            url = urllib.unquote(url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace("teletubbies", ""))
 +            self.logDebug("URL: %s" % url)
 +            return url
 +        else:
 +            self.fail("absolute filepath could not be found. offline? ")
 +       
 +    def get_file_name(self):
 +        if self.html is None:
 +            self.download_html()
 +
 +        return re.search("<title>\s*(.*?)\s*</title>", self.html).group(1)
 +
 +    def file_exists(self):
 +        """ returns True or False
 +        """
 +        if self.html is None:
 +            self.download_html()
 +            
 +        if re.search(r"HTTP Status 404", self.html) is not None:
 +            return False
 +        else:
 +            return True
 +
 +        
 +
 diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py index 8fe05a2b9..99f9f2366 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -32,14 +32,14 @@ def parseFileInfo(self, url):  def getInfo(urls):      for url in urls: -        file_info = parseFileInfo(plugin, url) +        file_info = parseFileInfo(ShragleCom, url)          yield file_info          class ShragleCom(Hoster):      __name__ = "ShragleCom"      __type__ = "hoster"      __pattern__ = r"http://(?:www.)?(cloudnator|shragle).com/files/(?P<ID>.*?)/" -    __version__ = "0.20" +    __version__ = "0.21"      __description__ = """Cloudnator.com (Shragle.com) Download PLugin"""      __author_name__ = ("RaNaN", "zoidberg")      __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz") @@ -103,4 +103,4 @@ class ShragleCom(Hoster):              self.wait()              self.retry() -            
\ No newline at end of file +             diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py new file mode 100644 index 000000000..32e7baf13 --- /dev/null +++ b/module/plugins/hoster/SpeedLoadOrg.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class SpeedLoadOrg(XFileSharingPro): +    __name__ = "SpeedLoadOrg" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?speedload\.org/(?P<ID>\w+)" +    __version__ = "1.01" +    __description__ = """Speedload.org hoster plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    FILE_NAME_PATTERN = r'Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>' +    FILE_SIZE_PATTERN = r'Size:</b></td><td>[\w. ]+<small>\((?P<S>\d+) bytes\)</small>' + +    HOSTER_NAME = "speedload.org" + +    def handlePremium(self): +        self.download(self.pyfile.url, post = self.getPostParameters()) + +getInfo = create_getInfo(SpeedLoadOrg) diff --git a/module/plugins/hoster/StahnuTo.py b/module/plugins/hoster/StahnuTo.py deleted file mode 100644 index 354a99b1a..000000000 --- a/module/plugins/hoster/StahnuTo.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- 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, parseFileInfo -from module.network.RequestFactory import getURL - -def getInfo(urls): -    result = [] - -    for url in urls: -        file_info = parseFileInfo(StahnuTo, url, getURL("http://stahnu.to/?file=" + re.search(StahnuTo.__pattern__, url).group(3), decode=True))  -        result.append(file_info) -             -    yield result - -class StahnuTo(SimpleHoster): -    __name__ = "StahnuTo" -    __type__ = "hoster" -    __pattern__ = r"http://(?:\w*\.)?stahnu.to/(?:files/get/|.*\?file=)(?P<ID>[^/]+).*" -    __version__ = "0.14" -    __description__ = """stahnu.to""" -    __author_name__ = ("zoidberg") - -    FILE_NAME_PATTERN = r"<td colspan='2'>Název souboru<br /><span>(?P<N>[^<]+)</span>" -    FILE_SIZE_PATTERN = r'<td>Velikost souboru<br /><span>(?P<S>[^<]+)\s*(?P<U>[kKMG])i?[Bb]</span></td>' -    FILE_OFFLINE_PATTERN = r'<!-- Obsah - start -->\s*<!-- Obsah - end -->' - -    def setup(self): -        self.multiDL = True - -    def process(self, pyfile): -        if not self.account: -            self.fail("Please enter your stahnu.to account") -                -        found = re.search(self.__pattern__, pyfile.url) -        file_id = found.group(1) - -        self.html = self.load("http://www.stahnu.to/getfile.php?file=%s" % file_id, decode=True)               -        self.getFileInfo() -         -        if "K stažení souboru se musíte <strong>zdarma</strong> přihlásit!" in self.html: -            self.account.relogin(self.user) -            self.retry() - -        self.download("http://www.stahnu.to/files/gen/" + file_id, post={ -            "downloadbutton":	u"STÁHNOUT" -        }) diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index b3b01c92b..b429d5510 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -24,6 +24,7 @@ import random  from urllib import quote  from binascii import hexlify, unhexlify  from Crypto.Cipher import ARC4 +import time  from module.network.RequestFactory import getURL  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp @@ -35,7 +36,7 @@ class TurbobitNet(SimpleHoster):      __name__ = "TurbobitNet"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)?(turbobit.net|unextfiles.com)/(?:download/free/)?(?P<ID>\w+).*" -    __version__ = "0.07" +    __version__ = "0.08"      __description__ = """Turbobit.net plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -150,7 +151,7 @@ class TurbobitNet(SimpleHoster):          cipher = ARC4.new(hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0'))          return unhexlify(cipher.encrypt(unhexlify(data))) -    def getLocalTimeString(): +    def getLocalTimeString(self):          lt = time.localtime()          tz = time.altzone if lt.tm_isdst else time.timezone           return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600)         @@ -166,4 +167,4 @@ class TurbobitNet(SimpleHoster):          self.logDebug(self.url)          self.download(self.url) -getInfo = create_getInfo(TurbobitNet)
\ No newline at end of file +getInfo = create_getInfo(TurbobitNet) diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py new file mode 100644 index 000000000..517df8561 --- /dev/null +++ b/module/plugins/hoster/TusfilesNet.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class TusfilesNet(XFileSharingPro): +    __name__ = "TusfilesNet" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?tusfiles\.net/\w{12}" +    __version__ = "0.01" +    __description__ = """Tusfiles.net hoster plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    FILE_INFO_PATTERN = r'<li>(?P<N>[^<]+)</li>\s+<li><b>Size:</b> <small>(?P<S>[\d.]+) (?P<U>\w+)</small></li>' +    FILE_OFFLINE_PATTERN = r'The file you were looking for could not be found' + +    HOSTER_NAME = "tusfiles.net" + +getInfo = create_getInfo(TusfilesNet) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index cf2f09311..5c38fdaad 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -27,12 +27,12 @@ class UlozTo(SimpleHoster):      __name__ = "UlozTo"      __type__ = "hoster"      __pattern__ = r"http://(\w*\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(?:live/)?(?P<id>\w+/[^/?]*)" -    __version__ = "0.89" +    __version__ = "0.92"      __description__ = """uloz.to"""      __author_name__ = ("zoidberg")      FILE_NAME_PATTERN = r'<a href="#download" class="jsShowDownload">(?P<N>[^<]+)</a>' -    FILE_SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[0-9.]+\s[kMG]B)</span>' +    FILE_SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[0-9.]+\s[kMG]?B)</span>'      FILE_INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>'      FILE_OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>'      FILE_SIZE_REPLACEMENTS = [('([0-9.]+)\s([kMG])B', convertDecimalPrefix)] @@ -80,7 +80,6 @@ class UlozTo(SimpleHoster):          # get and decrypt captcha          captcha_id_field = captcha_text_field = None -        captcha_id = captcha_text = None          for key in inputs.keys():                          found = re.match("captcha.*(id|text|value)", key) @@ -112,10 +111,10 @@ class UlozTo(SimpleHoster):          inputs.update({captcha_id_field: captcha_id, captcha_text_field: captcha_text}) -        self.download("http://www.ulozto.net" + action, post=inputs, cookies=True) +        self.download("http://www.ulozto.net" + action, post=inputs, cookies=True, disposition=True)      def handlePremium(self): -        self.download(self.pyfile.url + "?do=directDownload") +        self.download(self.pyfile.url + "?do=directDownload", disposition=True)          #parsed_url = self.findDownloadURL(premium=True)          #self.download(parsed_url, post={"download": "Download"}) @@ -154,4 +153,4 @@ class UlozTo(SimpleHoster):          elif check == "not_found":              self.fail("Server error - file not downloadable") -getInfo = create_getInfo(UlozTo)
\ No newline at end of file +getInfo = create_getInfo(UlozTo) diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index 8d950f0a6..c607e7a5b 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -17,13 +17,13 @@  """  import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError  class UloziskoSk(SimpleHoster):      __name__ = "UloziskoSk"      __type__ = "hoster"      __pattern__ = r"http://(\w*\.)?ulozisko.sk/.*" -    __version__ = "0.22" +    __version__ = "0.23"      __description__ = """Ulozisko.sk"""      __author_name__ = ("zoidberg") @@ -72,4 +72,4 @@ class UloziskoSk(SimpleHoster):              "but": "++++STIAHNI+S%DABOR++++"          }) -getInfo = create_getInfo(UloziskoSk)
\ No newline at end of file +getInfo = create_getInfo(UloziskoSk) diff --git a/module/plugins/hoster/UploadboxCom.py b/module/plugins/hoster/UploadboxCom.py deleted file mode 100644 index ce80b37dc..000000000 --- a/module/plugins/hoster/UploadboxCom.py +++ /dev/null @@ -1,95 +0,0 @@ -# -*- 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.DeadHoster import DeadHoster as SimpleHoster -    -""" -from module.network.RequestFactory import getURL - -def getInfo(urls): -    for url in urls: -        file_id = re.search(UploadboxCom.__pattern__, url).group(1) -        html = getURL('http://uploadbox.com/files/%s/?ac=lang&lang_new=en' % file_id, decode = False)  -        file_info = parseFileInfo(UploadboxCom, url, html) -        yield file_info -""" - -class UploadboxCom(SimpleHoster): -    __name__ = "Uploadbox" -    __type__ = "hoster" -    __pattern__ = r"http://(?:www\.)?uploadbox\.com/files/([^/]+).*" -    __version__ = "0.05" -    __description__ = """UploadBox.com plugin - free only""" -    __author_name__ = ("zoidberg") -    __author_mail__ = ("zoidberg@mujmail.cz") - -    FILE_NAME_PATTERN = r'<p><span>File name:</span>\s*(?P<N>[^<]+)</p>' -    FILE_SIZE_PATTERN = r'<span>Size:</span>\s*(?P<S>[0-9.]+) (?P<U>[kKMG])i?B <span>' -    FILE_OFFLINE_PATTERN = r'<strong>File deleted from service</strong>' -    FILE_NAME_REPLACEMENTS = [(r"(.*)", lambda m: unicode(m.group(1), 'koi8_r'))] -     -    FREE_FORM_PATTERN = r'<form action="([^"]+)" method="post" id="free" name="free">(.*?)</form>' -    FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]+)" />' -    LIMIT_EXCEEDED_PATTERN = r'<strong>The limit of traffic for you is exceeded. Please </strong> <br />wait <strong>(\d+)</strong> minutes' -    DOWNLOAD_URL_PATTERN = r'<iframe id="file_download"[^>]*src="([^"]+)"></iframe>' - -    def process(self, pyfile): -        self.file_id = re.search(self.__pattern__, pyfile.url).group(1) -        self.html = self.load('http://uploadbox.com/files/%s/?ac=lang&lang_new=en' % self.file_id, decode = False) -        self.getFileInfo() -        self.handleFree() - -    def handleFree(self): -        # Solve captcha -        url = 'http://uploadbox.com/files/' + self.file_id        -         -        for i in range(5): -            self.html = self.load(url, post = {"free": "yes"}) -            found = re.search(self.LIMIT_EXCEEDED_PATTERN, self.html) -            if found: -                self.setWait(int(found.group(1))*60, True) -                self.wait() -            else: -                break -        else: -            self.fail("Unable to get free download slot") -         -        for i in range(5): -            try: -                action, form = re.search(self.FREE_FORM_PATTERN, self.html, re.DOTALL).groups() -                inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) -            except Exception, e: -                self.logError(e) -                self.fail("Parse error on page 2") -             -            captcha_url = 'http://uploadbox.com/?ac=captcha&code=' + inputs['code']           -            inputs['enter'] = self.decryptCaptcha(captcha_url) -            self.html = self.load('http://uploadbox.com/' + action, post = inputs) -            found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) -            if found: -                self.correctCaptcha() -                download_url = found.group(1) -                break -            else: -                self.invalidCaptcha() -        else: -            self.fail("Incorrect captcha entered 5 times") - -        # Download -        self.download(download_url)
\ No newline at end of file diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 3cb1e71ff..ae70b1471 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -72,14 +72,15 @@ def getInfo(urls):  class UploadedTo(Hoster):      __name__ = "UploadedTo"      __type__ = "hoster" -    __pattern__ = r"http://[\w\.-]*?(uploaded\.(to|net)(/file/|/?\?id=|.*?&id=)|ul\.to/)\w+"    -    __version__ = "0.62" +    __pattern__ = r"http://[\w\.-]*?(uploaded\.(to|net)(/file/|/?\?id=|.*?&id=)|ul\.to/)\w+" +    __version__ = "0.64"      __description__ = """Uploaded.net Download Hoster""" -    __author_name__ = ("spoob", "mkaay", "zoidberg", "netpok") -    __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz", "netpok@gmail.com") +    __author_name__ = ("spoob", "mkaay", "zoidberg", "netpok", "stickell") +    __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz", "netpok@gmail.com", "l.stickell@yahoo.it")      FILE_INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a>  \s*<small[^>]*>(?P<S>[^<]+)</small>'      FILE_OFFLINE_PATTERN = r'<small class="cL">Error: 404</small>' +    DL_LIMIT_PATTERN = "You have reached the max. number of possible free downloads for this hour"      def setup(self):          self.html = None @@ -97,8 +98,7 @@ class UploadedTo(Hoster):          self.pyfile.url = "http://uploaded.net/file/%s" % self.fileID      def process(self, pyfile): -        self.req.cj.setCookie("uploaded.net", "lang", "en") # doesn't work anymore -        self.load("http://uploaded.net/language/en") +        self.load("http://uploaded.net/language/en", just_header=True)          api = getAPIData([pyfile.url]) @@ -163,7 +163,7 @@ class UploadedTo(Hoster):      def handleFree(self):          self.html = self.load(self.pyfile.url, decode=True) -         +          if 'var free_enabled = false;' in self.html:              self.logError("Free-download capacities exhausted.")              self.retry(24, 300) @@ -198,7 +198,7 @@ class UploadedTo(Hoster):                  self.retry()              elif "limit-parallel" in result:                  self.fail("Cannot download in parallel") -            elif "You have reached the max. number of possible free downloads for this hour" in result: # limit-dl +            elif self.DL_LIMIT_PATTERN in result: # limit-dl                  self.setWait(60 * 60, True)                  self.wait()                  self.retry() @@ -211,11 +211,13 @@ class UploadedTo(Hoster):                  break              else:                  self.fail("Unknown error '%s'") -                self.setWait(60 * 60, True) -                self.wait() -                self.retry()          if not downloadURL:              self.fail("No Download url retrieved/all captcha attempts failed")          self.download(downloadURL) +        check = self.checkDownload({"limit-dl": self.DL_LIMIT_PATTERN}) +        if check == "limit-dl": +            self.setWait(60 * 60, True) +            self.wait() +            self.retry() diff --git a/module/plugins/hoster/UploadkingCom.py b/module/plugins/hoster/UploadkingCom.py deleted file mode 100644 index be2d6c3bd..000000000 --- a/module/plugins/hoster/UploadkingCom.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- 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.DeadHoster import DeadHoster as SimpleHoster, create_getInfo -#from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo - -class UploadkingCom(SimpleHoster): -    __name__ = "UploadkingCom" -    __type__ = "hoster" -    __pattern__ = r"http://(?:www\.)?uploadking\.com/\w{10}" -    __version__ = "0.14" -    __description__ = """UploadKing.com plugin - free only""" -    __author_name__ = ("zoidberg") -    __author_mail__ = ("zoidberg@mujmail.cz") - -    FILE_NAME_PATTERN = r'<font style="font-size:\d*px;">File(?:name)?:\s*<(?:b|/font><font[^>]*)>(?P<N>[^<]+)' -    FILE_SIZE_PATTERN = r'<font style="font-size:\d*px;">(?:Files|S)ize:\s*<(?:b|/font><font[^>]*)>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B' -    FILE_OFFLINE_PATTERN = r'<center><font[^>]*>Unfortunately, this file is unavailable</font></center>' -    FILE_URL_PATTERN = r'id="dlbutton"><a href="([^"]+)"' - -    def handleFree(self):                  -        found = re.search(self.FILE_URL_PATTERN, self.html)  -        if not found: self.fail("Download URL not found") -        url = found.group(1) -        self.logDebug("DOWNLOAD URL: " + url)     -        self.download(url) - -create_getInfo(UploadkingCom)
\ No newline at end of file diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py new file mode 100644 index 000000000..60a93c1e5 --- /dev/null +++ b/module/plugins/hoster/UptoboxCom.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class UptoboxCom(XFileSharingPro): +    __name__ = "UptoboxCom" +    __type__ = "hoster" +    __pattern__ = r"http://(?:\w*\.)*?uptobox.com/\w{12}" +    __version__ = "0.06" +    __description__ = """Uptobox.com hoster plugin""" +    __author_name__ = ("zoidberg") +    __author_mail__ = ("zoidberg@mujmail.cz") +     +    FILE_INFO_PATTERN = r'<h2>\s*Download File\s*<span[^>]*>(?P<N>[^>]+)</span></h2>\s*[^\(]*\((?P<S>[^\)]+)\)</h2>' +    FILE_OFFLINE_PATTERN = r'<center>File Not Found</center>' +    HOSTER_NAME = "uptobox.com" +    +    def setup(self): +        self.resumeDownload = self.multiDL = self.premium         +        self.chunkLimit = 1 + +getInfo = create_getInfo(UptoboxCom)
\ No newline at end of file diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 06e59c7fa..23048b831 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -4,77 +4,77 @@ import re  from module.plugins.Hoster import Hoster  class VeehdCom(Hoster): -   __name__ = 'VeehdCom' -   __type__ = 'hoster' -   __pattern__ = r'http://veehd\.com/video/\d+_\S+' -   __config__ = [ -      ('filename_spaces', 'bool', "Allow spaces in filename", 'False'), -      ('replacement_char', 'str', "Filename replacement character", '_'), -   ] -   __version__ = '0.1' -   __description__ = """Veehd.com Download Hoster""" -   __author_name__ = ('cat') -   __author_mail__ = ('cat@pyload') -    -   def _debug(self, msg): -      self.log.debug('[%s] %s' % (self.__name__, msg)) -    -   def setup(self): -      self.html = None -      self.multiDL = True -      self.req.canContinue = True +    __name__ = 'VeehdCom' +    __type__ = 'hoster' +    __pattern__ = r'http://veehd\.com/video/\d+_\S+' +    __config__ = [ +        ('filename_spaces', 'bool', "Allow spaces in filename", 'False'), +        ('replacement_char', 'str', "Filename replacement character", '_'), +    ] +    __version__ = '0.2' +    __description__ = """Veehd.com Download Hoster""" +    __author_name__ = ('cat') +    __author_mail__ = ('cat@pyload') +     +    def _debug(self, msg): +        self.log.debug('[%s] %s' % (self.__name__, msg)) +     +    def setup(self): +        self.html = None +        self.multiDL = True +        self.req.canContinue = True -   def process(self, pyfile): -      self.download_html() -      if not self.file_exists(): -         self.offline() -          -      pyfile.name = self.get_file_name() -      self.download(self.get_file_url()) -       -   def download_html(self): -      url = self.pyfile.url -      self._debug("Requesting page: %s" % (repr(url),)) -      self.html = self.load(url) -       -   def file_exists(self): -      if self.html is None: -         self.download_html() -       -      if '<title>Veehd</title>' in self.html: -         return False -      return True -       -   def get_file_name(self): -      if self.html is None: -         self.download_html() -          -      match = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) -      if not match: -         self.fail("video title not found") -      name = match.group(1) -       -      # replace unwanted characters in filename -      if self.getConf('filename_spaces'): -         pattern = '[^0-9A-Za-z\.\ ]+' -      else: -         pattern = '[^0-9A-Za-z\.]+' -          -      name = re.sub('[^0-9A-Za-z\.]+', self.getConf('replacement_char'), -         name) -      return name + '.avi' +    def process(self, pyfile): +        self.download_html() +        if not self.file_exists(): +            self.offline() +             +        pyfile.name = self.get_file_name() +        self.download(self.get_file_url()) +         +    def download_html(self): +        url = self.pyfile.url +        self._debug("Requesting page: %s" % (repr(url),)) +        self.html = self.load(url) +         +    def file_exists(self): +        if self.html is None: +            self.download_html() +         +        if '<title>Veehd</title>' in self.html: +            return False +        return True +         +    def get_file_name(self): +        if self.html is None: +            self.download_html() +             +        match = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) +        if not match: +            self.fail("video title not found") +        name = match.group(1) +         +        # replace unwanted characters in filename +        if self.getConf('filename_spaces'): +            pattern = '[^0-9A-Za-z\.\ ]+' +        else: +            pattern = '[^0-9A-Za-z\.]+' +             +        name = re.sub(pattern, self.getConf('replacement_char'), +            name) +        return name + '.avi' -   def get_file_url(self): -      """ returns the absolute downloadable filepath -        """ -      if self.html is None: -         self.download_html() +    def get_file_url(self): +        """ returns the absolute downloadable filepath +          """ +        if self.html is None: +            self.download_html() -      match = re.search(r'<embed type="video/divx" ' -         r'src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', -         self.html) -      if not match: -         self.fail("embedded video url not found") -      file_url = match.group(1) +        match = re.search(r'<embed type="video/divx" ' +            r'src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', +            self.html) +        if not match: +            self.fail("embedded video url not found") +        file_url = match.group(1) -      return file_url +        return file_url diff --git a/module/plugins/hoster/WarserverCz.py b/module/plugins/hoster/WarserverCz.py index 423170319..b256f8d1b 100644 --- a/module/plugins/hoster/WarserverCz.py +++ b/module/plugins/hoster/WarserverCz.py @@ -16,19 +16,55 @@      @author: zoidberg  """ +#similar to coolshare.cz (down) +  import re -from module.plugins.hoster.CoolshareCz import CoolshareCz -from module.plugins.internal.SimpleHoster import create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.network.HTTPRequest import BadHeader +from module.utils import html_unescape -class WarserverCz(CoolshareCz): +class WarserverCz(SimpleHoster):      __name__ = "WarserverCz"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)?warserver.cz/stahnout/(?P<ID>\d+)/.+" -    __version__ = "0.11" +    __version__ = "0.12"      __description__ = """Warserver.cz"""      __author_name__ = ("zoidberg")      FILE_NAME_PATTERN = r'<h1.*?>(?P<N>[^<]+)</h1>' +    FILE_SIZE_PATTERN = r'<li>Velikost: <strong>(?P<S>[^<]+)</strong>' +    FILE_OFFLINE_PATTERN = r'<h1>Soubor nenalezen</h1>' +     +    PREMIUM_URL_PATTERN = r'href="(http://[^/]+/dwn-premium.php.*?)"' +    DOMAIN = "http://csd01.coolshare.cz" +          DOMAIN = "http://s01.warserver.cz"            +               +    def handleFree(self): +        try:       +            self.download("%s/dwn-free.php?fid=%s" % (self.DOMAIN, self.file_info['ID']))     +        except BadHeader, e: +            self.logError(e) +            if e.code == 403: +                self.longWait(60,60) +            else: raise +        self.checkDownloadedFile() +         +    def handlePremium(self): +        found = re.search(self.PREMIUM_URL_PATTERN, self.html) +        if not found: self.parseError("Premium URL") +        url = html_unescape(found.group(1)) +        self.logDebug("Premium URL: " + url)         +        if not url.startswith("http://"): self.resetAccount() +        self.download(url) +        self.checkDownloadedFile()   +         +    def checkDownloadedFile(self): +        check = self.checkDownload({ +            "offline": ">404 Not Found<" +            }) + +        if check == "offline": +            self.offline()       getInfo = create_getInfo(WarserverCz)
\ No newline at end of file diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index b60fda7e4..195e65a93 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -24,7 +24,7 @@ class WebshareCz(SimpleHoster):      __name__ = "WebshareCz"      __type__ = "hoster"      __pattern__ = r"http://(\w+\.)?webshare.cz/(stahnout/)?(?P<ID>\w{10})-.+" -    __version__ = "0.11" +    __version__ = "0.12"      __description__ = """WebShare.cz"""      __author_name__ = ("zoidberg") @@ -33,6 +33,9 @@ class WebshareCz(SimpleHoster):      FILE_OFFLINE_PATTERN = r'<h3>Soubor ".*?" nebyl nalezen.</h3>'      DOWNLOAD_LINK_PATTERN = r'id="download_link" href="(?P<url>.*?)"' +     +    def setup(self): +        self.multiDL = True      def handleFree(self):          url_a = re.search(r"(var l.*)", self.html).group(1) diff --git a/module/plugins/hoster/X7To.py b/module/plugins/hoster/X7To.py index 2ba534cff..79adf2a3f 100644 --- a/module/plugins/hoster/X7To.py +++ b/module/plugins/hoster/X7To.py @@ -13,7 +13,7 @@ class X7To(Hoster):      __name__ = "X7To"
      __type__ = "hoster"
      __pattern__ = r"http://(?:www.)?x7.to/"
 -    __version__ = "0.2"
 +    __version__ = "0.3"
      __description__ = """X7.To File Download Hoster"""
      __author_name__ = ("ernieb")
      __author_mail__ = ("ernieb")
 @@ -54,40 +54,40 @@ class X7To(Hoster):          # find file id
          file_id = re.search(r"var dlID = '(.*?)'", self.html)
          if not file_id:
 -	    self.fail("Free download id not found")
 -	
 -	file_url = "http://x7.to/james/ticket/dl/" + file_id.group(1)
 -	self.logDebug("download id %s" % file_id.group(1))
 -
 -	self.html = self.load(file_url, ref=False, decode=True)
 -
 -	# deal with errors
 -	if "limit-dl" in self.html:
 -	    self.logDebug("Limit reached ... waiting")
 -	    self.setWait(900,True)
 -	    self.wait()
 -	    self.retry()
 -
 -	if "limit-parallel" in self.html:
 -	    self.fail("Cannot download in parallel")
 -
 -	# no waiting required, go to download
 -	waitCheck = re.search(r"wait:(\d*),", self.html)
 -	if waitCheck:
 -	    waitCheck = int(waitCheck.group(1))
 -	    self.setWait(waitCheck)
 -	    self.wait()
 -
 -	urlCheck = re.search(r"url:'(.*?)'", self.html)
 -	url = None
 -	if urlCheck:
 -	    url = urlCheck.group(1)
 -	    self.logDebug("free url found %s" % url)
 -
 -	if url:
 -	    try:
 -		self.download(url)
 -	    except:
 -		self.logDebug("downloading url failed: %s" % url)
 -	else:
 -	    self.fail("Free download url found")
 +            self.fail("Free download id not found")
 +
 +        file_url = "http://x7.to/james/ticket/dl/" + file_id.group(1)
 +        self.logDebug("download id %s" % file_id.group(1))
 +
 +        self.html = self.load(file_url, ref=False, decode=True)
 +
 +        # deal with errors
 +        if "limit-dl" in self.html:
 +            self.logDebug("Limit reached ... waiting")
 +            self.setWait(900,True)
 +            self.wait()
 +            self.retry()
 +
 +        if "limit-parallel" in self.html:
 +            self.fail("Cannot download in parallel")
 +
 +        # no waiting required, go to download
 +        waitCheck = re.search(r"wait:(\d*),", self.html)
 +        if waitCheck:
 +            waitCheck = int(waitCheck.group(1))
 +            self.setWait(waitCheck)
 +            self.wait()
 +
 +        urlCheck = re.search(r"url:'(.*?)'", self.html)
 +        url = None
 +        if urlCheck:
 +            url = urlCheck.group(1)
 +            self.logDebug("free url found %s" % url)
 +
 +        if url:
 +            try:
 +                self.download(url)
 +            except:
 +                self.logDebug("downloading url failed: %s" % url)
 +        else:
 +            self.fail("Free download url found")
 diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 8e213e9bf..1120a2a8b 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -3,7 +3,7 @@      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.  +    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 @@ -23,6 +23,7 @@ from urlparse import urlparse  from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError  from module.plugins.ReCaptcha import ReCaptcha +from module.plugins.internal.CaptchaService import SolveMedia, AdsCaptcha  from module.utils import html_unescape  class XFileSharingPro(SimpleHoster): @@ -34,7 +35,7 @@ class XFileSharingPro(SimpleHoster):      __name__ = "XFileSharingPro"      __type__ = "hoster"      __pattern__ = r"^unmatchable$" -    __version__ = "0.11" +    __version__ = "0.17"      __description__ = """XFileSharingPro common hoster base"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -42,7 +43,7 @@ class XFileSharingPro(SimpleHoster):      FILE_NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"'      FILE_SIZE_PATTERN = r'You have requested <font color="red">[^<]+</font> \((?P<S>[^<]+)\)</font>'      FILE_INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>' -    FILE_OFFLINE_PATTERN = r'<(b|h2)>File Not Found</(b|h2)>' +    FILE_OFFLINE_PATTERN = r'<(b|h[1-6])>File Not Found</(b|h[1-6])>'      WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>'      LONG_WAIT_PATTERN = r'(?P<H>\d+(?=\s*hour))?.*?(?P<M>\d+(?=\s*minute))?.*?(?P<S>\d+(?=\s*second))?' @@ -51,21 +52,20 @@ class XFileSharingPro(SimpleHoster):      CAPTCHA_URL_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)'      RECAPTCHA_URL_PATTERN = r'http://[^"\']+?recaptcha[^"\']+?\?k=([^"\']+)"'      CAPTCHA_DIV_PATTERN = r'<b>Enter code.*?<div.*?>(.*?)</div>' -    ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</'       -     +    SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"' +    ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</' +      def setup(self): -        self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] -        self.multiDL = True -        self.chunkLimit = 1  +        if self.__name__ == "XFileSharingPro": +            self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] +            self.multiDL = True +        else: +            self.resumeDownload = self.multiDL = self.premium + +        self.chunkLimit = 1      def process(self, pyfile): -        if not hasattr(self, "HOSTER_NAME"):  -            self.HOSTER_NAME = re.search(self.__pattern__, self.pyfile.url).group(1) -        if not hasattr(self, "DIRECT_LINK_PATTERN"):  -            self.DIRECT_LINK_PATTERN = r'(http://(\w+\.%s|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\d+/\w+/)[^"\'<]+)' % self.HOSTER_NAME -     -        self.captcha = self.errmsg = None -        self.passwords = self.getPassword().splitlines() +        self.prepare()          if not re.match(self.__pattern__, self.pyfile.url):              if self.premium: @@ -78,58 +78,74 @@ class XFileSharingPro(SimpleHoster):                  self.file_info = self.getFileInfo()              except PluginParseError:                  self.file_info = None -                 -            self.req.http.lastURL = self.pyfile.url -             -            self.req.http.c.setopt(FOLLOWLOCATION, 0) -            self.html = self.load(self.pyfile.url, cookies = True, decode = True) -            self.header = self.req.http.header -            self.req.http.c.setopt(FOLLOWLOCATION, 1) -            self.location = None -            found = re.search("Location\s*:\s*(.*)", self.header, re.I) -            if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)): -                self.location = found.group(1).strip()                  -                      +            self.location = self.getDirectDownloadLink() +              if not self.file_info:                  pyfile.name = html_unescape(unquote(urlparse(self.location if self.location else pyfile.url).path.split("/")[-1])) -             -            if self.location:     + +            if self.location:                  self.startDownload(self.location)              elif self.premium:                  self.handlePremium()              else:                  self.handleFree() +    def prepare(self): +        """ Initialize important variables """ +        if not hasattr(self, "HOSTER_NAME"): +            self.HOSTER_NAME = re.search(self.__pattern__, self.pyfile.url).group(1) +        if not hasattr(self, "DIRECT_LINK_PATTERN"): +            self.DIRECT_LINK_PATTERN = r'(http://([^/]*?%s|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\d+/\w+/)[^"\'<]+)' % self.HOSTER_NAME + +        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 + +        self.req.http.c.setopt(FOLLOWLOCATION, 0) +        self.html = self.load(self.pyfile.url, cookies = True, decode = True) +        self.header = self.req.http.header +        self.req.http.c.setopt(FOLLOWLOCATION, 1) + +        location = None +        found = re.search("Location\s*:\s*(.*)", self.header, re.I) +        if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)): +            location = found.group(1).strip() + +        return location +      def handleFree(self):          url = self.getDownloadLink()          self.logDebug("Download URL: %s" % url)          self.startDownload(url) -         +      def getDownloadLink(self):          for i in range(5):              self.logDebug("Getting download link: #%d" % i)              data = self.getPostParameters() -             +              self.req.http.c.setopt(FOLLOWLOCATION, 0)              self.html = self.load(self.pyfile.url, post = data, ref = True, decode = True)              self.header = self.req.http.header -            self.req.http.c.setopt(FOLLOWLOCATION, 1)             -             +            self.req.http.c.setopt(FOLLOWLOCATION, 1) +              found = re.search("Location\s*:\s*(.*)", self.header, re.I) -            if found:                 +            if found:                  break -                                           +              found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S) -            if found:                 -                break  +            if found: +                break          else: -            if captcha in self.err:   +            if self.errmsg and 'captcha' in self.errmsg:                  self.fail("No valid captcha code entered")              else:                  self.fail("Download link not found") -         +          return found.group(1)      def handlePremium(self): @@ -137,7 +153,7 @@ class XFileSharingPro(SimpleHoster):          found = re.search(self.DIRECT_LINK_PATTERN, self.html)          if not found: self.parseError('DIRECT LINK')          self.startDownload(found.group(1)) -         +      def handleOverriden(self):          #only tested with easybytez.com          self.html = self.load("http://www.%s/" % self.HOSTER_NAME) @@ -161,8 +177,8 @@ class XFileSharingPro(SimpleHoster):          elif inputs['st'] == 'Can not leech file':              self.retry(max_tries=20, wait_time=180, reason=inputs['st'])          else: -            self.fail(inputs['st'])     -         +            self.fail(inputs['st']) +          #get easybytez.com link for uploaded file          found = re.search(self.OVR_DOWNLOAD_LINK_PATTERN, self.html)          if not found: self.parseError('DIRECT LINK (OVR)') @@ -170,6 +186,7 @@ class XFileSharingPro(SimpleHoster):          self.retry()      def startDownload(self, link): +        link = link.strip()          if self.captcha: self.correctCaptcha()          self.logDebug('DIRECT LINK: %s' % link)          self.download(link) @@ -184,65 +201,69 @@ class XFileSharingPro(SimpleHoster):                  wait_time = sum([int(v) * {"hour": 3600, "minute": 60, "second": 1}[u] for v, u in re.findall('(\d+)\s*(hour|minute|second)?', self.errmsg)])                  self.setWait(wait_time, True)                  self.wait() +            elif 'captcha' in self.errmsg: +                self.invalidCaptcha() +            elif 'premium' in self.errmsg and 'require' in self.errmsg: +                self.fail("File can be downloaded by premium users only")              elif 'limit' in self.errmsg:                  self.setWait(3600, True)                  self.wait()                  self.retry(25) -            elif 'captcha' in self.errmsg: -                self.invalidCaptcha() -            elif 'countdown' or 'Expired session' in self.errmsg: +            elif 'countdown' in self.errmsg or 'Expired session' in self.errmsg:                  self.retry(3)              elif 'maintenance' in self.errmsg:                  self.tempOffline()              elif 'download files up to' in self.errmsg:                  self.fail("File too large for free download") -            elif 'requires premium' in self.errmsg: -                self.fail("File can be downloaded by premium users only")              else:                  self.fail(self.errmsg) -             +          else:              self.errmsg = None -         +          return self.errmsg      def getPostParameters(self):          for i in range(3):              if not self.errmsg: self.checkErrors() -            action, inputs = self.parseHtmlForm('F1') -            if not inputs:  -                action, inputs = self.parseHtmlForm("action=(''|\"\")") -                if not inputs:  +            if hasattr(self,"FORM_PATTERN"): +                action, inputs = self.parseHtmlForm(self.FORM_PATTERN) +            else: +                action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) + +            if not inputs: +                action, inputs = self.parseHtmlForm('F1') +                if not inputs:                      if self.errmsg:                          self.retry()                      else:                          self.parseError("Form not found") -                     +              self.logDebug(self.HOSTER_NAME, inputs) -             -            if 'op' in inputs and inputs['op'] in ('download2', 'download3'):                     + +            if 'op' in inputs and inputs['op'] in ('download2', 'download3'):                  if "password" in inputs:                      if self.passwords:                          inputs['password'] = self.passwords.pop(0)                      else:                          self.fail("No or invalid passport") -             -                if not self.premium:                 + +                if not self.premium:                      found = re.search(self.WAIT_PATTERN, self.html)                      if found:                          wait_time = int(found.group(1)) + 1                          self.setWait(wait_time, False)                      else:                          wait_time = 0 -                     +                      self.captcha = self.handleCaptcha(inputs)                      if wait_time: self.wait() -                 +                  self.errmsg = None                  return inputs -             +              else:                  inputs['referer'] = self.pyfile.url @@ -257,7 +278,7 @@ class XFileSharingPro(SimpleHoster):                  self.errmsg = None          else: self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN')) -     +      def handleCaptcha(self, inputs):          found = re.search(self.RECAPTCHA_URL_PATTERN, self.html)          if found: @@ -273,14 +294,21 @@ class XFileSharingPro(SimpleHoster):                  inputs['code'] = self.decryptCaptcha(captcha_url)                  return 2              else: -                found = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.S)   +                found = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.S)                  if found:                      captcha_div = found.group(1) -                    self.logDebug(captcha_div)   +                    self.logDebug(captcha_div)                      numerals = re.findall('<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))                      inputs['code'] = "".join([a[1] for a in sorted(numerals, key = lambda num: int(num[0]))]) -                    self.logDebug("CAPTCHA", inputs['code'], numerals)  -                    return 3                 +                    self.logDebug("CAPTCHA", inputs['code'], numerals) +                    return 3 +                else: +                    found = re.search(self.SOLVEMEDIA_PATTERN, self.html) +                    if found: +                        captcha_key = found.group(1) +                        captcha = SolveMedia(self) +                        inputs['adcopy_challenge'], inputs['adcopy_response'] = captcha.challenge(captcha_key) +                        return 4          return 0 -         -getInfo = create_getInfo(XFileSharingPro)
\ No newline at end of file + +getInfo = create_getInfo(XFileSharingPro) diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py new file mode 100644 index 000000000..0779a78e6 --- /dev/null +++ b/module/plugins/hoster/XHamsterCom.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster +from urllib import unquote +from module.common.json_layer import json_loads + +def clean_json(json_expr): +    json_expr = re.sub('[\n\r]', '', json_expr) +    json_expr = re.sub(' +', '', json_expr) +    json_expr = re.sub('\'','"', json_expr) + +    return json_expr +     +class XHamsterCom(Hoster): +    __name__ = "XHamsterCom" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?xhamster\.com/movies/.+" +    __version__ = "0.1" +    __config__ = [("type", ".mp4;.flv", "Preferred type", ".mp4")] +    __description__ = """XHamster.com Video Download Hoster""" + +    def setup(self): +        self.html = None +         +    def process(self, pyfile): +        self.pyfile = pyfile +         +        if not self.file_exists(): +            self.offline() + +        if self.getConfig("type"): +            self.desired_fmt = self.getConf("type")     +            +        self.pyfile.name = self.get_file_name() + self.desired_fmt +        self.download(self.get_file_url()) + +    def download_html(self): +        url = self.pyfile.url +        self.html = self.load(url) + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        if self.html is None: +            self.download_html() +                          +        flashvar_pattern = re.compile('flashvars = ({.*?});', re.DOTALL) +        json_flashvar=flashvar_pattern.search(self.html) + +        if json_flashvar is None: +            self.fail("Parse error (flashvars)") + +        j = clean_json(json_flashvar.group(1)) +        flashvars = json_loads(j) +         +        if flashvars["srv"]: +            srv_url  =  flashvars["srv"] + '/' +        else: +            self.fail("Parse error (srv_url)") +             +        if flashvars["url_mode"]: +            url_mode  =  flashvars["url_mode"] +        else: +            self.fail("Parse error (url_mode)") +         + +        if self.desired_fmt == ".mp4": +            file_url = re.search(r"<a href=\"" + srv_url + "(.+?)\"", self.html) +            if file_url is None: +                self.fail("Parse error (file_url)") +            file_url=file_url.group(1) +            long_url = srv_url + file_url +            self.logDebug(_("long_url: %s") % long_url) +        else: +            if flashvars["file"]: +                file_url = unquote(flashvars["file"]) +            else: +                self.fail("Parse error (file_url)") + +            if url_mode=='3': +                long_url = file_url +                self.logDebug(_("long_url: %s") % long_url) +            else:     +                long_url = srv_url + "key=" + file_url +                self.logDebug(_("long_url: %s") % long_url) +                 +        return long_url +   + +    def get_file_name(self): +        if self.html is None: +            self.download_html() + +        file_name_pattern = r"<title>(.*?) - xHamster\.com</title>" +        file_name = re.search(file_name_pattern, self.html) +        if file_name is None: +            file_name_pattern = r"<h1 >(.*)</h1>" +            file_name = re.search(file_name_pattern, self.html) +            if file_name is None: +                file_name_pattern = r"http://[www.]+xhamster\.com/movies/.*/(.*?)\.html?" +                file_name = re.search(file_name_pattern, self.pyfile.url) +                if file_name is None: +                    file_name_pattern = r"<div id=\"element_str_id\" style=\"display:none;\">(.*)</div>" +                    file_name = re.search(file_name_pattern, self.html) +                    if file_name is None: +                        return "Unknown" + +        return file_name.group(1) + +    def file_exists(self): +        """ returns True or False +        """ +        if self.html is None: +            self.download_html() +        if re.search(r"(.*Video not found.*)", self.html) is not None: +            return False +        else: +            return True diff --git a/module/plugins/hoster/XvidstageCom.py b/module/plugins/hoster/XvidstageCom.py new file mode 100644 index 000000000..14079df43 --- /dev/null +++ b/module/plugins/hoster/XvidstageCom.py @@ -0,0 +1,105 @@ +# -*- 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: 4Christopher +""" + +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL +import re +import HTMLParser + +def setup(self): +	self.wantReconnect = False +	self.resumeDownload = True +	self.multiDL = True + +def getInfo(urls): +	result = [] + +	for url in urls: +		result.append(parseFileInfo(url, getInfoMode = True)) +	yield result + +def parseFileInfo(url, getInfoMode = False): +	html = getURL(url) +	info = {"name" : url, "size" : 0, "status" : 3} +	try: +		info['name'] = re.search(r'(?:Filename|Dateiname):</b></td><td nowrap[^>]*?>(.*?)<', html).group(1) +		info['size'] = re.search(r'(?:Size|Größe):</b></td><td>.*? <small>\((\d+?) bytes\)', html).group(1) +	except: ## The file is offline +		info['status'] = 1 +	else: +		info['status'] = 2 + +	if getInfoMode: +		return info['name'], info['size'], info['status'], url +	else: +		return info['name'], info['size'], info['status'], html + +class XvidstageCom(Hoster): +	__name__ = 'XvidstageCom' +	__version__ = '0.3' +	__pattern__ = r'http://(?:www.)?xvidstage.com/(?P<id>[0-9A-Za-z]+)' +	__type__ = 'hoster' +	__description__ = """A Plugin that allows you to download files from http://xvidstage.com""" +	__author_name__ = ('4Christopher') +	__author_mail__ = ('4Christopher@gmx.de') + + +	def process(self, pyfile): +		pyfile.name, pyfile.size, pyfile.status, self.html = parseFileInfo(pyfile.url) +		self.logDebug('Name: %s' % pyfile.name) +		if pyfile.status == 1: ## offline +			self.fail() +		self.id = re.search(self.__pattern__, pyfile.url).group('id') + +		wait_sec = int(re.search(r'countdown_str">.+?>(\d+?)<', self.html).group(1)) +		self.setWait(wait_sec, reconnect=False) +		self.logDebug('Waiting %d seconds before submitting the captcha' % wait_sec) +		self.wait() + +		rand = re.search(r'<input type="hidden" name="rand" value="(.*?)">', self.html).group(1) +		self.logDebug('rand: %s, id: %s' % (rand, self.id)) +		self.html = self.req.load(pyfile.url, post={'op': 'download2', 'id' : self.id, 'rand' : rand, 'code': self.get_captcha()}) +		file_url = re.search(r'<a href="(?P<url>.*?)">(?P=url)</a>', self.html).group('url') +		try: +			hours_file_available = int(re.search(r'This direct link will be available for your IP next (?P<hours>\d+?) hours', self.html).group('hours')) +			self.logDebug('You have %d hours to download this file with your current IP address.' % hours_file_available) +		except: +			self.logDebug('Failed') +		self.logDebug('Download file: %s' % file_url) +		self.download(file_url) +		check = self.checkDownload({'empty': re.compile(r'^$')}) + +		if check == 'empty': +			self.logInfo('Downloaded File was empty') +			# self.retry() + +	def get_captcha(self): +		## <span style='position:absolute;padding-left:7px;padding-top:6px;'>1 … +		cap_chars = {} +		for pad_left, char in re.findall(r"position:absolute;padding-left:(\d+?)px;.*?;'>(.*?)<", self.html): +			cap_chars[int(pad_left)] = char + +		h = HTMLParser.HTMLParser() +		## Sorting after padding-left +		captcha = '' +		for pad_left in sorted(cap_chars): +			captcha += h.unescape(cap_chars[pad_left]) + +		self.logDebug('The captcha is: %s' % captcha) +		return captcha diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index 5926cc227..901225944 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -24,7 +24,7 @@ class YibaishiwuCom(SimpleHoster):      __name__ = "YibaishiwuCom"      __type__ = "hoster"      __pattern__ = r"http://(?:www\.)?(?:u\.)?115.com/file/(?P<ID>\w+)" -    __version__ = "0.11" +    __version__ = "0.12"      __description__ = """115.com"""      __author_name__ = ("zoidberg") @@ -45,10 +45,10 @@ class YibaishiwuCom(SimpleHoster):              try:                  url = mirror['url'].replace('\\','')                  self.logDebug("Trying URL: " + url) -                header = self.download(url) +                self.download(url)                  break              except:                  continue          else: self.fail('No working link found') -getInfo = create_getInfo(YibaishiwuCom)
\ No newline at end of file +getInfo = create_getInfo(YibaishiwuCom) diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 3ba40e937..a9fed5638 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -10,32 +10,45 @@ from module.plugins.Hoster import Hoster  class YoutubeCom(Hoster):      __name__ = "YoutubeCom"      __type__ = "hoster" -    __pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*" -    __version__ = "0.25" -    __config__ = [("quality", "sd;hd;fullhd", "Quality Setting", "hd"), -        ("fmt", "int", "FMT Number 0-45", 0), +    __pattern__ = r"(http|https)://(www\.)?(de\.)?\youtube\.com/watch\?v=.*" +    __version__ = "0.29" +    __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting", "hd"), +        ("fmt", "int", "FMT/ITAG Number (5-102, 0 for auto)", 0),          (".mp4", "bool", "Allow .mp4", True),          (".flv", "bool", "Allow .flv", True),          (".webm", "bool", "Allow .webm", False), -        (".3gp", "bool", "Allow .3gp", False)] +        (".3gp", "bool", "Allow .3gp", False), +        ("3d", "bool", "Prefer 3D", False)]      __description__ = """Youtube.com Video Download Hoster""" -    __author_name__ = ("spoob") -    __author_mail__ = ("spoob@pyload.org") - -    # name, width, height, quality ranking -    formats = {17: (".3gp", 176, 144, 0), -               5: (".flv", 400, 240, 1), -               18: (".mp4", 480, 360, 2), -               43: (".webm", 640, 360, 3), -               34: (".flv", 640, 360, 4), -               44: (".webm", 854, 480, 5), -               35: (".flv", 854, 480, 6), -               45: (".webm", 1280, 720, 7), -               22: (".mp4", 1280, 720, 8), -               37: (".mp4", 1920, 1080, 9), -               38: (".mp4", 4096, 3072, 10), +    __author_name__ = ("spoob", "zoidberg") +    __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") + +    # name, width, height, quality ranking, 3D +    formats = {5: (".flv", 400, 240, 1, False),  +                6: (".flv", 640, 400, 4, False), +               17: (".3gp", 176, 144, 0, False),  +               18: (".mp4", 480, 360, 2, False), +               22: (".mp4", 1280, 720, 8, False), +               43: (".webm", 640, 360, 3, False), +               34: (".flv", 640, 360, 4, False), +               35: (".flv", 854, 480, 6, False), +                36: (".3gp", 400, 240, 1, False), +               37: (".mp4", 1920, 1080, 9, False), +               38: (".mp4", 4096, 3072, 10, False), +               44: (".webm", 854, 480, 5, False), +               45: (".webm", 1280, 720, 7, False),  +                46: (".webm", 1920, 1080, 9, False), +                82: (".mp4", 640, 360, 3, True), +                83: (".mp4", 400, 240, 1, True), +                84: (".mp4", 1280, 720, 8, True), +                85: (".mp4", 1920, 1080, 9, True), +                100: (".webm", 640, 360, 3, True), +                101: (".webm", 640, 360, 4, True), +                102: (".webm", 1280, 720, 8, True)                 } +    def setup(self): +        self.resumeDownload = self.multiDL = True      def process(self, pyfile):          html = self.load(pyfile.url, decode=True) @@ -45,56 +58,61 @@ class YoutubeCom(Hoster):          if "We have been receiving a large volume of requests from your network." in html:              self.tempOffline() - -        #videoId = pyfile.url.split("v=")[1].split("&")[0] -        #videoHash = re.search(r'&t=(.+?)&', html).group(1) - -        file_name_pattern = '<meta name="title" content="(.+?)">' - -        quality = self.getConf("quality") -        desired_fmt = 18 - -        if quality == "sd": -            desired_fmt = 18 -        elif quality == "hd": -            desired_fmt = 22 -        elif quality == "fullhd": -            desired_fmt = 37 - -        if self.getConfig("fmt"): -            desired_fmt = self.getConf("fmt") - -        flashvars = re.search(r'flashvars=\\"(.*?)\\"', html) -        flashvars = unquote(flashvars.group(1)) - -        fmts = re.findall(r'url=(.*?)%3B.*?itag=(\d+)', flashvars) -        fmt_dict = {} -        for url, fmt in fmts: -            fmt = int(fmt) -            fmt_dict[fmt] = unquote(url) - -        self.logDebug("Found links: %s" % fmt_dict) -        for fmt in fmt_dict.keys(): -            if fmt not in self.formats: -                self.logDebug("FMT not supported: %s" % fmt) -                del fmt_dict[fmt] - -        allowed = lambda x: self.getConfig(self.formats[x][0]) -        sel = lambda x: self.formats[x][3] #select quality index -        comp = lambda x, y: abs(sel(x) - sel(y)) - -        #return fmt nearest to quali index -        fmt = reduce(lambda x, y: x if comp(x, desired_fmt) <= comp(y, desired_fmt) and -                                       sel(x) > sel(y) and -                                       allowed(x) else y, fmt_dict.keys()) +        #get config +        use3d = self.getConf("3d") +        if use3d: +            quality = {"sd":82,"hd":84,"fullhd":85,"240p":83,"360p":82,"480p":82,"720p":84,"1080p":85,"3072p":85}  +        else: +            quality = {"sd":18,"hd":22,"fullhd":37,"240p":5,"360p":18,"480p":35,"720p":22,"1080p":37,"3072p":38}  +        desired_fmt = self.getConf("fmt") +        if desired_fmt and desired_fmt not in self.formats: +            self.logWarning("FMT %d unknown - using default." % desired_fmt)  +            desired_fmt = 0  +        if not desired_fmt: +            desired_fmt = quality.get(self.getConf("quality"), 18)         +         +        #parse available streams +        streams = re.search(r'"url_encoded_fmt_stream_map": "(.*?)",', html).group(1) +        streams = [x.split('\u0026') for x in streams.split(',')] +        streams = [dict((y.split('=',1)) for y in x) for x in streams] +        streams = [(int(x['itag']), "%s&signature=%s" % (unquote(x['url']), x['sig'])) for x in streams] +        #self.logDebug("Found links: %s" % streams)  +        self.logDebug("AVAILABLE STREAMS: %s" % [x[0] for x in streams])                     +         +        #build dictionary of supported itags (3D/2D) +        allowed = lambda x: self.getConfig(self.formats[x][0])         +        streams = [x for x in streams if x[0] in self.formats and allowed(x[0])] +        if not streams: +            self.fail("No available stream meets your preferences") +        fmt_dict = dict([x for x in streams if self.formats[x[0]][4] == use3d] or streams)               +                 +        self.logDebug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" %  +                          (desired_fmt,  +                           "%s %dx%d Q:%d 3D:%s" % self.formats[desired_fmt], +                           "" if desired_fmt in fmt_dict else "NOT ",  +                           "" if allowed(desired_fmt) else "NOT ") +                      )         + +        #return fmt nearest to quality index         +        if desired_fmt in fmt_dict and allowed(desired_fmt): +            fmt = desired_fmt +        else: +            sel = lambda x: self.formats[x][3] #select quality index +            comp = lambda x, y: abs(sel(x) - sel(y)) +         +            self.logDebug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()]) +            fmt = reduce(lambda x, y: x if comp(x, desired_fmt) <= comp(y, desired_fmt) and +                                       sel(x) > sel(y) else y, fmt_dict.keys()) -        self.logDebug("Choose fmt: %s" % fmt) +        self.logDebug("Chosen fmt: %s" % fmt) +        url = fmt_dict[fmt] +        self.logDebug("URL: %s" % url) -        file_suffix = ".flv" -        if fmt in self.formats: -            file_suffix = self.formats[fmt][0] +        #set file name         +        file_suffix = self.formats[fmt][0] if fmt in self.formats else ".flv" +        file_name_pattern = '<meta name="title" content="(.+?)">'          name = re.search(file_name_pattern, html).group(1).replace("/", "") + file_suffix          pyfile.name = html_unescape(name) - -        self.download(fmt_dict[fmt]) +         +        self.download(url)
\ No newline at end of file diff --git a/module/plugins/hoster/ZShareNet.py b/module/plugins/hoster/ZShareNet.py deleted file mode 100644 index 6ef456d97..000000000 --- a/module/plugins/hoster/ZShareNet.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import re -import random - -from module.utils import parseFileSize -from module.plugins.Hoster import Hoster - -class ZShareNet(Hoster): -    __name__ = "ZShareNet" -    __type__ = "hoster" -    __pattern__ = r"http://[\w\.]*?zshare\.net/(download|video|image|audio|flash)/.*" -    __version__ = "0.2" -    __description__ = """ZShareNet Download Hoster""" -    __author_name__ = ("espes","Cptn Sandwich") - -    def setup(self): -        self.multiDL = False -        self.html = None - -    def process(self, pyfile): -        self.pyfile = pyfile -         -        self.pyfile.url = re.sub("(video|image|audio|flash)","download",self.pyfile.url)  -         -        self.html = self.load(pyfile.url) -        if "File Not Found" in self.html: -            self.offline() -         -        filenameMatch = re.search("File Name:.*?<font color=\"#666666\".*?>(.*?)</font>", self.html, re.DOTALL) -        filesizeMatch = re.search("File Size:.*?<font color=\"#666666\".*?>([^<]+)</font>", self.html, re.DOTALL) -        if not filenameMatch or not filesizeMatch: -            self.offline() -        filename = filenameMatch.group(1) -        filesize = filesizeMatch.group(1) -        if filename.strip() == "": -            self.offline() -         -        pyfile.name = filename - -        pyfile.size = parseFileSize(filesize) -       -        if '<input name="download"' not in self.html: -            self.fail("No download form") -         -        self.html = self.load(pyfile.url, post={ -            "download": 1, -            "imageField.x": random.randrange(160), -            "imageField.y": random.randrange(60)}) -         -        dllinkMatch = re.search("var link_enc\\=new Array\\(\\'(.*?)\\'\\)", self.html) -        if dllinkMatch: -            dllink = re.sub("\\'\\,\\'", "", dllinkMatch.group(1)) -        else: -            self.fail("Plugin defect") -         -        self.setWait(51) -        self.wait() -         -        self.download(dllink) -        check = self.checkDownload({ -            "unav": "/images/download.gif", -            "404": "404 - Not Found" -        }) -        #print check -        if check == "unav": -            self.fail("Plugin defect") -        elif check == "404": -            self.offline() diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py new file mode 100644 index 000000000..b912436a7 --- /dev/null +++ b/module/plugins/internal/CaptchaService.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 + +class CaptchaService():     +    __version__ = "0.02" +     +    def __init__(self, plugin): +        self.plugin = plugin +         +class ReCaptcha(): +    def __init__(self, plugin): +        self.plugin = plugin +     +    def challenge(self, id): +        js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={"k":id}, cookies=True) +         +        try: +            challenge = re.search("challenge : '(.*?)',", js).group(1) +            server = re.search("server : '(.*?)',", js).group(1) +        except: +            self.plugin.fail("recaptcha error") +        result = self.result(server,challenge) +         +        return challenge, result + +    def result(self, server, challenge): +        return self.plugin.decryptCaptcha("%simage"%server, get={"c":challenge}, cookies=True, forceUser=True, imgtype="jpg")     + +class AdsCaptcha(CaptchaService): +    def challenge(self, src): +        js = self.plugin.req.load(src, cookies=True) +         +        try: +            challenge = re.search("challenge: '(.*?)',", js).group(1) +            server = re.search("server: '(.*?)',", js).group(1) +        except: +            self.plugin.fail("adscaptcha error") +        result = self.result(server,challenge) +         +        return challenge, result + +    def result(self, server, challenge): +        return self.plugin.decryptCaptcha("%sChallenge.aspx" % server, get={"cid": challenge, "dummy": random()}, cookies=True, imgtype="jpg") + +class SolveMedia(CaptchaService): +    def __init__(self,plugin): +        self.plugin = plugin + +    def challenge(self, src): +        html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.noscript?k=%s" % src, cookies=True) +        try: +            challenge = re.search(r'<input type=hidden name="adcopy_challenge" id="adcopy_challenge" value="([^"]+)">', html).group(1) +        except: +            self.plugin.fail("solvmedia error") +        result = self.result(challenge) +         +        return challenge, result + +    def result(self,challenge): +        return self.plugin.decryptCaptcha("http://api.solvemedia.com/papi/media?c=%s" % challenge,imgtype="gif")
\ No newline at end of file diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 69798bc0a..b8942c724 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -13,32 +13,53 @@      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  """ -from re import findall +import re  from module.plugins.Crypter import Crypter  class SimpleCrypter(Crypter):      __name__ = "SimpleCrypter" -    __version__ = "0.01" +    __version__ = "0.03"      __pattern__ = None      __type__ = "crypter"      __description__ = """Base crypter plugin""" -    __author_name__ = ("zoidberg") -    __author_mail__ = ("zoidberg@mujmail.cz") +    __author_name__ = ("stickell", "zoidberg") +    __author_mail__ = ("l.stickell@yahoo.it", "zoidberg@mujmail.cz") +    """ +    These patterns should be defined by each hoster: + +    LINK_PATTERN: group(1) must be a download link +    example: <div class="link"><a href="(http://speedload.org/\w+) + +    TITLE_PATTERN: (optional) the group defined by 'title' should be the title +    example: <title>Files of: (?P<title>[^<]+) folder</title> +    """ -    def init(self): -        self.url = self.pyfile.url -          def decrypt(self, pyfile): -        self.html = self.load(self.url) +        self.html = self.load(pyfile.url) -        new_links = [] -        new_links.extend(findall(self.LINK_PATTERN, self.html)) +        package_name, folder_name = self.getPackageNameAndFolder() -        if new_links: -            self.core.files.addLinks(new_links, self.pyfile.package().id) +        package_links = re.findall(self.LINK_PATTERN, self.html) +        self.logDebug('Package has %d links' % len(package_links)) + +        if package_links: +            self.packages = [(package_name, package_links, folder_name)]          else: -            self.fail('Could not extract any links')
\ No newline at end of file +            self.fail('Could not extract any links') + +    def getPackageNameAndFolder(self): +        if hasattr(self, 'TITLE_PATTERN'): +            m = re.search(self.TITLE_PATTERN, self.html) +            if m: +                name = folder = m.group('title') +                self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) +                return name, folder + +        name = self.pyfile.package().name +        folder = self.pyfile.package().folder +        self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) +        return name, folder diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index a2e246d44..666374a22 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -31,48 +31,65 @@ def replace_patterns(string, ruleslist):          string = re.sub(rf, rt, string)          #self.logDebug(rf, rt, string)      return string -     +  def set_cookies(cj, cookies):      for cookie in cookies:          if isinstance(cookie, tuple) and len(cookie) == 3:              domain, name, value = cookie              cj.setCookie(domain, name, value) -     +  def parseHtmlTagAttrValue(attr_name, tag): -        m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^>\s\"'][^>\s]*)\1" % attr_name, tag, re.I)    +        m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^>\s\"'][^>\s]*)\1" % attr_name, tag, re.I)          return m.group(2) if m else None -         -def parseHtmlForm(attr_str, html): -    inputs = {} -    action = None  -    form = re.search(r"(?P<tag><form[^>]*%s[^>]*>)(?P<content>.*?)</(form|body|html)[^>]*>" % attr_str, html, re.S | re.I) -    if form: + +def parseHtmlForm(attr_str, html, input_names=None): +    for form in re.finditer(r"(?P<tag><form[^>]*%s[^>]*>)(?P<content>.*?)</?(form|body|html)[^>]*>" % attr_str, html, re.S | re.I): +        inputs = {}          action = parseHtmlTagAttrValue("action", form.group('tag')) -        for input in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('content'), re.S | re.I): -            name = parseHtmlTagAttrValue("name", input.group(1)) +        for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('content'), re.S | re.I): +            name = parseHtmlTagAttrValue("name", inputtag.group(1))              if name: -                value = parseHtmlTagAttrValue("value", input.group(1)) +                value = parseHtmlTagAttrValue("value", inputtag.group(1))                  if value is None: -                    inputs[name] = input.group(3) or '' +                    inputs[name] = inputtag.group(3) or ''                  else:                      inputs[name] = value -                 -    return action, inputs -def parseFileInfo(self, url = '', html = ''):     +        if isinstance(input_names, dict): +            # check input attributes +            for key, val in input_names.items(): +                if key in inputs: +                    if isinstance(val, basestring) and inputs[key] == val: +                        continue +                    elif isinstance(val, tuple) and inputs[key] in val: +                        continue +                    elif hasattr(val, "search") and re.match(val, inputs[key]): +                        continue +                    break # attibute value does not match +                else: +                    break # attibute name does not match +            else: +                return action, inputs # passed attribute check +        else: +            # no attribute check +            return action, inputs + +    return {}, None # no matching form found + +def parseFileInfo(self, url = '', html = ''):      info = {"name" : url, "size" : 0, "status" : 3} -     -    if hasattr(self, "pyfile"):   -        url = self.pyfile.url  + +    if hasattr(self, "pyfile"): +        url = self.pyfile.url      if hasattr(self, "req") and self.req.http.code == '404':          info['status'] = 1      else:          if not html and hasattr(self, "html"): html = self.html -        if isinstance(self.SH_BROKEN_ENCODING, (str, unicode)):  +        if isinstance(self.SH_BROKEN_ENCODING, (str, unicode)):              html = unicode(html, self.SH_BROKEN_ENCODING)              if hasattr(self, "html"): self.html = html -         +          if hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html):              # File offline              info['status'] = 1 @@ -82,7 +99,7 @@ def parseFileInfo(self, url = '', html = ''):                  info.update(re.match(self.__pattern__, url).groupdict())              except:                  pass -             +              for pattern in ("FILE_INFO_PATTERN", "FILE_NAME_PATTERN", "FILE_SIZE_PATTERN"):                  try:                      info.update(re.search(getattr(self, pattern), html).groupdict()) @@ -129,7 +146,7 @@ class PluginParseError(Exception):  class SimpleHoster(Hoster):      __name__ = "SimpleHoster" -    __version__ = "0.26" +    __version__ = "0.28"      __pattern__ = None      __type__ = "hoster"      __description__ = """Base hoster plugin""" @@ -147,13 +164,13 @@ class SimpleHoster(Hoster):      FILE_SIZE_REPLACEMENTS = []      FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup)]      FILE_URL_REPLACEMENTS = [] -     +      SH_BROKEN_ENCODING = False # Set to True or encoding name if encoding in http header is not correct      SH_COOKIES = True # or False or list of tuples [(domain, name, value)]      SH_CHECK_TRAFFIC = False # True = force check traffic left for a premium account -     +      def init(self): -        self.file_info = {}  +        self.file_info = {}      def setup(self):          self.resumeDownload = self.multiDL = True if self.premium else False @@ -161,6 +178,7 @@ class SimpleHoster(Hoster):      def process(self, pyfile):          pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) +        self.req.setOption("timeout", 120)          self.html = self.load(pyfile.url, decode = not self.SH_BROKEN_ENCODING, cookies = self.SH_COOKIES)          self.getFileInfo()          if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()): @@ -168,13 +186,17 @@ class SimpleHoster(Hoster):          else:              self.handleFree() +    def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False): +        if type(url) == unicode: url = url.encode('utf8') +        return Hoster.load(self, url=url, get=get, post=post, ref=ref, cookies=cookies, just_header=just_header, decode=decode) +      def getFileInfo(self):          self.logDebug("URL: %s" % self.pyfile.url)          if hasattr(self, "TEMP_OFFLINE_PATTERN") and re.search(self.TEMP_OFFLINE_PATTERN, self.html):              self.tempOffline()          name, size, status = parseFileInfo(self)[:3] -         +          if status == 1:              self.offline()          elif status != 2: @@ -202,26 +224,28 @@ class SimpleHoster(Hoster):      def parseError(self, msg):          raise PluginParseError(msg) -     +      def longWait(self, wait_time = None, max_tries = 3):          if wait_time and isinstance(wait_time, (int, long, float)):              time_str = "%dh %dm" % divmod(wait_time / 60, 60)          else:              wait_time = 900              time_str = "(unknown time)" -            max_tries = 100             -         +            max_tries = 100 +          self.logInfo("Download limit reached, reconnect or wait %s" % time_str) -                 +          self.setWait(wait_time, True)          self.wait() -        self.retry(max_tries = max_tries, reason="Download limit reached")    +        self.retry(max_tries = max_tries, reason="Download limit reached") + +    def parseHtmlForm(self, attr_str='', input_names=None): +        return parseHtmlForm(attr_str, self.html, input_names) -    def parseHtmlForm(self, attr_str): -        return parseHtmlForm(attr_str, self.html) -     -    def checkTrafficLeft(self):                    +    def checkTrafficLeft(self):          traffic = self.account.getAccountInfo(self.user, True)["trafficleft"] +        if traffic == -1: +            return True          size = self.pyfile.size / 1024 -        self.logInfo("Filesize: %i KiB, Traffic left for user %s: %i KiB" % (size, self.user, traffic))                +        self.logInfo("Filesize: %i KiB, Traffic left for user %s: %i KiB" % (size, self.user, traffic))          return  size <= traffic
\ No newline at end of file diff --git a/module/plugins/internal/XFSPAccount.py b/module/plugins/internal/XFSPAccount.py index ad25ad2c8..8333c7265 100644 --- a/module/plugins/internal/XFSPAccount.py +++ b/module/plugins/internal/XFSPAccount.py @@ -33,7 +33,7 @@ class XFSPAccount(Account):      MAIN_PAGE = None -    VALID_UNTIL_PATTERN = r'>Premium account expire:</TD><TD><b>([^<]+)</b>' +    VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:</TD><TD><b>([^<]+)</b>'      TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><b>([^<]+)</b>'      def loadAccountInfo(self, user, req):        | 
