diff options
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/accounts/UploadingCom.py | 52 | ||||
| -rw-r--r-- | module/plugins/hoster/UploadingCom.py | 22 | 
2 files changed, 69 insertions, 5 deletions
| diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py new file mode 100644 index 000000000..507e4ab18 --- /dev/null +++ b/module/plugins/accounts/UploadingCom.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: mkaay +""" + +from module.plugins.Account import Account +from time import time, strptime, mktime +import re + +class UploadingCom(Account): +    __name__ = "UploadingCom" +    __version__ = "0.1" +    __type__ = "account" +    __description__ = """uploading.com account plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def loadAccountInfo(self, user, req): +        src = req.load("http://uploading.com/") +        premium = True +        if "UPGRADE TO PREMIUM" in src: +            return {"validuntil": -1, "trafficleft": -1, "premium": False} +         +        m = re.search("Valid Until:(.*?)<", src) +        if m: +            validuntil = int(mktime(strptime(m.group(1).strip(), "%b %d, %Y"))) +        else: +            validuntil = -1 +         +        return {"validuntil": validuntil, "trafficleft": -1, "premium": True} +         +    def login(self, user, data, req): +        req.cj.setCookie("uploading.com", "lang", "1") +        req.cj.setCookie("uploading.com", "language", "1") +        req.cj.setCookie("uploading.com", "setlang", "en") +        req.cj.setCookie("uploading.com", "_lang", "en") +        req.load("http://uploading.com/") +        req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time()*1000), post={"email": user, "password": data["password"], "remember": "on"}) diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 5843180a7..1f3889f0e 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -30,16 +30,18 @@ class UploadingCom(Hoster):      __name__ = "UploadingCom"
      __type__ = "hoster"
      __pattern__ = r"http://(?:www\.)?uploading\.com/files/(?:get/)?[\w\d]+/?"
 -    __version__ = "0.1"
 +    __version__ = "0.2"
      __description__ = """Uploading.Com File Download Hoster"""
 -    __author_name__ = ("jeix")
 -    __author_mail__ = ("jeix@hasnomail.de")
 +    __author_name__ = ("jeix", "mkaay")
 +    __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de")
      def setup(self):
          self.html = [None,None,None]
          if self.account:
 -            self.req.canContinue = True
 +            self.resumeDownload = True
 +            self.multiDL = True
          else:
 +            self.resumeDownload = False
              self.multiDL = False
      def process(self, pyfile):
 @@ -66,7 +68,17 @@ class UploadingCom(Hoster):          self.download(url)
      def handlePremium(self):
 -        pass
 +        postData = {}
 +        postData['action'] = 'get_link'
 +        postData['code']   = re.search('code: "(.*?)",', self.html[0]).group(1)
 +        postData['pass']   = 'undefined'
 +
 +        self.html[2] = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
 +        url = re.search(r'"link"\s*:\s*"(.*?)"', self.html[2])
 +        if url:
 +            return url.group(1).replace("\\/", "/")
 +        
 +        raise Exception("Plugin defect.")
      def handleFree(self):
          self.code   = re.search(r'name="code" value="(.*?)"', self.html[0]).group(1)
 | 
