diff options
| author | 2010-05-06 21:15:03 +0200 | |
|---|---|---|
| committer | 2010-05-06 21:15:03 +0200 | |
| commit | 4adeedcf1e09fcefe2f8c758199d6fafebebce28 (patch) | |
| tree | 7c0e9b33b4be03fd68e0484d4cfd7d006a683f46 /module/plugins/hoster | |
| parent | better request factory (diff) | |
| download | pyload-4adeedcf1e09fcefe2f8c758199d6fafebebce28.tar.xz | |
account plugins: first draft
Diffstat (limited to 'module/plugins/hoster')
| -rw-r--r-- | module/plugins/hoster/RapidshareCom.py | 30 | ||||
| -rw-r--r-- | module/plugins/hoster/UploadedTo.py | 19 | 
2 files changed, 31 insertions, 18 deletions
diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index cfed29331..da38d4b3a 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -26,13 +26,20 @@ class RapidshareCom(Hoster):          self.no_slots = True          self.api_data = None          self.url = self.parent.url +        self.props = {}          self.read_config() +        self.account = None +        self.multi_dl = False          if self.config['premium']: -            self.multi_dl = True -            self.req.canContinue = True -        else: -            self.multi_dl = False - +            self.account = self.parent.core.pluginManager.getAccountPlugin(self.__name__) +            req = self.account.getAccountRequest(self) +            if req: +                self.req = req +                self.multi_dl = True +                self.req.canContinue = True +            else: +                self.config['premium'] = False +                  self.start_dl = False      def prepare(self, thread): @@ -73,7 +80,7 @@ class RapidshareCom(Hoster):          """          api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"          api_param_file = {"sub": "checkfiles_v1", "files": "", "filenames": "", "incmd5": "1"} -        m = re.compile(self.props['pattern']).search(self.url) +        m = re.compile(self.__pattern__).search(self.url)          if m:              api_param_file["files"] = m.group(1)              api_param_file["filenames"] = m.group(2) @@ -122,13 +129,13 @@ class RapidshareCom(Hoster):      def download_html(self):          """ gets the url from self.parent.url saves html in self.html and parses          """ -        self.html[0] = self.load(self.url, cookies=True) +        self.html[0] = self.load(self.url, cookies=False)      def get_wait_time(self):          """downloads html with the important informations          """          file_server_url = re.search(r"<form action=\"(.*?)\"", self.html[0]).group(1) -        self.html[1] = self.load(file_server_url, cookies=True, post={"dl.start": "Free"}) +        self.html[1] = self.load(file_server_url, cookies=False, post={"dl.start": "Free"})          if re.search(r"is already downloading", self.html[1]):              self.logger.info(_("Rapidshare: Already downloading, wait 30 minutes")) @@ -171,9 +178,10 @@ class RapidshareCom(Hoster):          return self.url.split("/")[-1]      def proceed(self, url, location): -        if self.config['premium']: -            self.req.add_auth(self.config['username'], self.config['password']) -        self.download(url, location) +        #if self.config['premium']: +        #    data = self.account.getAccountData(self) +        #    self.req.add_auth(data[0], data[1]) +        self.download(url, location, cookies=True)      def check_file(self, local_file):          if self.api_data and self.api_data["checksum"]: diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 93caa39b3..43f54c099 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -22,11 +22,17 @@ class UploadedTo(Hoster):          self.api_data = None          self.want_reconnect = False          self.read_config() +        self.account = None +        self.multi_dl = False          if self.config['premium']: -            self.multi_dl = True -            self.req.canContinue = True -        else: -            self.multi_dl = False +            self.account = self.parent.core.pluginManager.getAccountPlugin(self.__name__) +            req = self.account.getAccountRequest(self) +            if req: +                self.req = req +                self.multi_dl = True +                self.req.canContinue = True +            else: +                self.config['premium'] = False          self.start_dl = False @@ -35,7 +41,7 @@ class UploadedTo(Hoster):          tries = 0          while not self.pyfile.status.url: -            self.req.clear_cookies() +            #self.req.clear_cookies()              self.download_html()              self.pyfile.status.exists = self.file_exists() @@ -68,7 +74,7 @@ class UploadedTo(Hoster):      def download_api_data(self):          url = self.parent.url -        match = re.compile(self.props['pattern']).search(url) +        match = re.compile(self.__pattern__).search(url)          if match:              src = self.load("http://uploaded.to/api/file", cookies=False, get={"id": match.group(1).split("/")[0]})              if not src.find("404 Not Found"): @@ -129,7 +135,6 @@ class UploadedTo(Hoster):      def proceed(self, url, location):          if self.config['premium']: -            self.load("http://uploaded.to/login", None, { "email" : self.config['username'], "password" : self.config['password']}, cookies=True)              self.load(url, cookies=True, just_header=True)              if self.cleanUrl(self.req.lastEffectiveURL) == self.cleanUrl(url):                  self.logger.info(_("UploadedTo indirect download"))  | 
