diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Account.py | 67 | ||||
-rw-r--r-- | module/plugins/accounts/RapidshareCom.py | 38 | ||||
-rw-r--r-- | module/plugins/accounts/UploadedTo.py | 36 | ||||
-rw-r--r-- | module/plugins/accounts/__init__.py | 0 | ||||
-rw-r--r-- | module/plugins/hoster/RapidshareCom.py | 30 | ||||
-rw-r--r-- | module/plugins/hoster/UploadedTo.py | 19 |
6 files changed, 172 insertions, 18 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py new file mode 100644 index 000000000..3588cd51e --- /dev/null +++ b/module/plugins/Account.py @@ -0,0 +1,67 @@ +# -*- 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 random import randrange + +class Account(): + __name__ = "Account" + __version__ = "0.1" + __type__ = "account" + __description__ = """Account Plugin""" + __author_name__ = ("mkaay") + __author_mail__ = ("mkaay@mkaay.de") + + def __init__(self, manager): + self.manager = manager + self.core = manager.core + self.configParser = self.core.parser_plugins + + self.accounts = [] + self.register = {} + self.loadAccounts() + + def login(self): + pass + + def getAccountRequest(self, plugin): + account = self.getAccountData(plugin) + req = self.core.requestFactory.getRequest(self.__name__, account[0]) + return req + + def loadAccounts(self): + usernames = self.configParser.get(self.__name__, "username") + passwords = self.configParser.get(self.__name__, "password") + + data = zip(usernames.split("\n"), passwords.split("\n")) + self.accounts = [] + for acc in data: + t = (acc[0].strip(), acc[1].strip()) + if t[0] and t[1]: + self.accounts.append(t) + + self.login() + + def getAccountData(self, plugin): + if not len(self.accounts): + return None + if not self.register.has_key(plugin): + account = self.accounts[randrange(0, len(self.accounts), 1)] + else: + account = self.register[plugin] + return account diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py new file mode 100644 index 000000000..bd1b944b3 --- /dev/null +++ b/module/plugins/accounts/RapidshareCom.py @@ -0,0 +1,38 @@ +# -*- 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 + +class RapidshareCom(Account): + __name__ = "RapidshareCom" + __version__ = "0.1" + __type__ = "account" + __description__ = """Rapidshare.com account plugin""" + __author_name__ = ("mkaay") + __author_mail__ = ("mkaay@mkaay.de") + + def getAccountInfo(self): + pass + + def login(self): + for account in self.accounts: + req = self.core.requestFactory.getRequest(self.__name__, account[0]) + html = req.load("http://ssl.rapidshare.com/cgi-bin/premiumzone.cgi", get={"login":account[0], "password":account[1]}, cookies=True) + with open("dump%s.html" % account[0], "w") as f: + f.write(html) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py new file mode 100644 index 000000000..a477fa6b1 --- /dev/null +++ b/module/plugins/accounts/UploadedTo.py @@ -0,0 +1,36 @@ +# -*- 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 + +class UploadedTo(Account): + __name__ = "UploadedTo" + __version__ = "0.1" + __type__ = "account" + __description__ = """ul.to account plugin""" + __author_name__ = ("mkaay") + __author_mail__ = ("mkaay@mkaay.de") + + def getAccountInfo(self): + pass + + def login(self): + for account in self.accounts: + req = self.core.requestFactory.getRequest(self.__name__, account[0]) + req.load("http://uploaded.to/login", None, { "email" : account[0], "password" : account[1]}, cookies=True) diff --git a/module/plugins/accounts/__init__.py b/module/plugins/accounts/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/module/plugins/accounts/__init__.py 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")) |