summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/FileDatabase.py8
-rw-r--r--module/plugins/Plugin.py6
-rw-r--r--module/plugins/accounts/ShareonlineBiz.py40
-rw-r--r--module/plugins/crypter/DDLMusicOrg.py66
-rw-r--r--module/plugins/crypter/SerienjunkiesOrg.py1
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py164
6 files changed, 140 insertions, 145 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py
index c89656407..127a2cef4 100644
--- a/module/FileDatabase.py
+++ b/module/FileDatabase.py
@@ -259,7 +259,7 @@ class FileHandler:
if self.cache.has_key(id):
return self.cache[id].toDbDict()
- return self.db.getLinkData()
+ return self.db.getLinkData(id)
#----------------------------------------------------------------------
def getFile(self, id):
@@ -659,8 +659,8 @@ class FileDatabaseBackend(Thread):
}
return data
-
-
+
+ @queue
def getLinkData(self, id):
"""get link information as dict"""
self.c.execute('SELECT id,url,name,size,status,error,plugin,package,linkorder FROM links WHERE id=?', (str(id),))
@@ -1089,4 +1089,4 @@ if __name__ == "__main__":
e = time()
- print "complete data", e-d \ No newline at end of file
+ print "complete data", e-d
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index aa4aff171..a3a4ffcb1 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -179,10 +179,10 @@ class Plugin(object):
""" begin again from the beginning """
raise Retry
- def decryptCaptcha(self, url, get={}, post={}):
+ def decryptCaptcha(self, url, get={}, post={}, cookies=False, forceUser=False):
""" loads the catpcha and decrypt it or ask the user for input """
- content = self.load(url, get, post)
+ content = self.load(url, get=get, post=post, cookies=cookies)
temp = NamedTemporaryFile()
@@ -192,7 +192,7 @@ class Plugin(object):
Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__)
- if Ocr:
+ if Ocr or not forceUser:
sleep(randint(3000, 5000) / 1000.0)
if self.pyfile.abort: raise Abort
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py
new file mode 100644
index 000000000..096d98273
--- /dev/null
+++ b/module/plugins/accounts/ShareonlineBiz.py
@@ -0,0 +1,40 @@
+# -*- 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 ShareonlineBiz(Account):
+ __name__ = "ShareonlineBiz"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """share-online.biz account plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
+ #@TODO: account info
+
+ def login(self):
+ for user, data in self.accounts.items():
+ req = self.core.requestFactory.getRequest(self.__name__, user)
+ post_vars = {"user": user,
+ "pass": data["password"],
+ "l_rememberme":"1"}
+ print post_vars
+ req.lastURL = "http://www.share-online.biz/alpha/"
+ req.load("https://www.share-online.biz/alpha/user/login", cookies=True, post=post_vars)
diff --git a/module/plugins/crypter/DDLMusicOrg.py b/module/plugins/crypter/DDLMusicOrg.py
index 1c5632cda..a82fa5a1c 100644
--- a/module/plugins/crypter/DDLMusicOrg.py
+++ b/module/plugins/crypter/DDLMusicOrg.py
@@ -10,47 +10,33 @@ class DDLMusicOrg(Crypter):
__name__ = "DDLMusicOrg"
__type__ = "container"
__pattern__ = r"http://[\w\.]*?ddl-music\.org/captcha/ddlm_cr\d\.php\?\d+\?\d+"
- __version__ = "0.1"
+ __version__ = "0.3"
__description__ = """ddl-music.org Container Plugin"""
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def __init__(self, parent):
- Crypter.__init__(self, parent)
- self.parent = parent
- self.html = None
- self.multi_dl = False
-
- def download_html(self):
- url = self.parent.url
- self.html = self.req.load(url, cookies=True)
-
- def file_exists(self):
- """ returns True or False
- """
- if not self.html:
- self.download_html()
- if re.search(r"Wer dies nicht rechnen kann", self.html) != None:
- return True
- return False
-
- def proceed(self, url, location):
- for i in range(5):
- self.download_html()
- posturl = re.search(r"id=\"captcha\" action=\"(/captcha/ddlm_cr\d\.php)\"", self.html).group(1)
- math = re.search(r"(\d+) ([\+-]) (\d+) =\s+<inp", self.html)
- id = re.search(r"name=\"id\" value=\"(\d+)\"", self.html).group(1)
- linknr = re.search(r"name=\"linknr\" value=\"(\d+)\"", self.html).group(1)
-
- solve = ""
- if math.group(2) == "+":
- solve = int(math.group(1)) + int(math.group(3))
- else:
- solve = int(math.group(1)) - int(math.group(3))
- sleep(3)
- htmlwithlink = self.req.load("http://ddl-music.org%s" % posturl, cookies=True, post={"calc%s" % linknr:solve, "send%s" % linknr:"Send", "id":id, "linknr":linknr})
- m = re.search(r"<form id=\"ff\" action=\"(.*?)\" method=\"post\">", htmlwithlink)
- if m:
- self.links = [m.group(1)]
- return
- self.links = False
+ def setup(self):
+ self.multiDL = False
+
+ def decrypt(self, pyfile):
+ html = self.req.load(self.pyfile.url, cookies=True)
+
+ if re.search(r"Wer dies nicht rechnen kann", html) != None:
+ self.offline()
+
+ math = re.search(r"(\d+) ([\+-]) (\d+) =\s+<inp", self.html)
+ id = re.search(r"name=\"id\" value=\"(\d+)\"", self.html).group(1)
+ linknr = re.search(r"name=\"linknr\" value=\"(\d+)\"", self.html).group(1)
+
+ solve = ""
+ if math.group(2) == "+":
+ solve = int(math.group(1)) + int(math.group(3))
+ else:
+ solve = int(math.group(1)) - int(math.group(3))
+ sleep(3)
+ htmlwithlink = self.req.load(self.pyfile.url, cookies=True, post={"calc%s" % linknr:solve, "send%s" % linknr:"Send", "id":id, "linknr":linknr})
+ m = re.search(r"<form id=\"ff\" action=\"(.*?)\" method=\"post\">", htmlwithlink)
+ if m:
+ self.packages.append((self.pyfile.package().name, [m.group(1)], self.pyfile.package().folder))
+ else:
+ self.retry()
diff --git a/module/plugins/crypter/SerienjunkiesOrg.py b/module/plugins/crypter/SerienjunkiesOrg.py
index 99eaa3f3c..49ec049bc 100644
--- a/module/plugins/crypter/SerienjunkiesOrg.py
+++ b/module/plugins/crypter/SerienjunkiesOrg.py
@@ -145,6 +145,7 @@ class SerienjunkiesOrg(Crypter):
if decrypted == str(url):
continue
self.packages.append((self.pyfile.package().name, [decrypted], self.pyfile.package().folder))
+ break
def handleFrame(self, url):
self.req.load(str(url), cookies=False, just_header=True)
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 928bce1f5..7958de794 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -12,129 +12,97 @@ import random
from time import sleep
from module.plugins.Hoster import Hoster
+from module.network.Request import getURL
+
+def getInfo(urls):
+ api_url_base = "http://www.share-online.biz/linkcheck/linkcheck.php"
+ api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/","") for x in urls)} #api only supports old style links
+ src = getURL(api_url_base, post=api_param_file)
+ result = []
+ for i, res in enumerate(src.split("\n")):
+ fields = res.split(";")
+ status = 2 if self.api_data["status"] == "OK" else 3
+ result.append((fields[2], int(fields[3]), status, urls[i]))
+ return result
class ShareonlineBiz(Hoster):
__name__ = "ShareonlineBiz"
__type__ = "hoster"
- __pattern__ = r"(?:http://)?(?:www.)?share-online.biz/download.php\?id="
- __version__ = "0.1"
+ __pattern__ = r"(?:http://)?(?:www.)?share-online.biz/(download.php\?id=|dl/)"
+ __version__ = "0.2"
__description__ = """Shareonline.biz Download Hoster"""
- __author_name__ = ("spoob")
- __author_mail__ = ("spoob@pyload.org")
-
- def __init__(self, parent):
- Hoster.__init__(self, parent)
- self.parent = parent
- self.html = [None, None]
- self.want_reconnect = False
- self.init_ocr()
- self.url = self.parent.url
- self.read_config()
- if self.config['premium']:
- self.multi_dl = True
- else:
- self.multi_dl = False
+ __author_name__ = ("spoob", "mkaay")
+ __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de")
- def prepare(self, thread):
- pyfile = self.parent
+ def setup(self):
+ #self.req.canContinue = self.multiDL = True if self.account else False
+ # range request not working?
+ self.multiDL = True if self.account else False
- self.download_api_data()
- if self.api_data["status"]:
- for i in range(5):
- if self.download_html():
- break
- else:
- pyfile.status.waituntil = self.time_plus_wait
- thread.wait(self.pyfile)
- pyfile.status.filename = self.api_data["filename"]
- pyfile.status.waituntil = self.time_plus_wait
- pyfile.status.url = self.get_file_url()
- pyfile.status.want_reconnect = self.want_reconnect
- return True
- else:
- return False
+ def process(self, pyfile):
+ self.convertURL()
+ self.downloadAPIData()
+ pyfile.name = self.api_data["filename"]
+ pyfile.sync()
+
+ self.downloadHTML()
+
+ self.download(self.getFileUrl(), cookies=True)
- def download_api_data(self):
- """
- http://images.rapidshare.com/apidoc.txt
- """
+ def downloadAPIData(self):
api_url_base = "http://www.share-online.biz/linkcheck/linkcheck.php?md5=1"
- api_param_file = {"links": self.url}
+ 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)
-
+
fields = src.split(";")
self.api_data = {}
self.api_data["fileid"] = fields[0]
self.api_data["status"] = fields[1]
- if self.api_data["status"] == "NOTFOUND":
- return
+ if not self.api_data["status"] == "OK":
+ self.offline()
self.api_data["filename"] = fields[2]
self.api_data["size"] = fields[3] # in bytes
- self.api_data["checksum"] = fields[4].strip().lower().replace("\n\n", "") # md5
+ self.api_data["checksum"] = fields[4].strip().lower().replace("\n\n", "") # md5
- def download_html(self):
- if self.config['premium']:
- post_vars = {"act": "login",
- "location": "service.php",
- "dieseid": "",
- "user": self.config['username'],
- "pass": self.config['password'],
- "login":"Log+me+in",
- "folder_autologin":"1"}
- self.load("http://www.share-online.biz/login.php", cookies=True, post=post_vars)
- url = self.parent.url
- self.html[0] = self.load(url, cookies=True)
+ def downloadHTML(self):
+ self.html = self.load(self.pyfile.url, cookies=True)
+ with open("sobiz_dump.html", "w") as f:
+ f.write(self.html)
- if not self.config['premium']:
- #captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name
-
- for i in range(10):
- try:
- captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg", delete=False)
-
- # Fallback for python version <2.6
- except TypeError:
- captcha_image_name = os.path.join(tempfile.gettempdir(), "pyload_tmp_%d"%time())
- captcha_image = open(captcha_image_name, "w+b")
-
- imgStr = self.req.load("http://www.share-online.biz/captcha.php?rand="+ "0." + str(random.randint(10**15,10**16)), cookies=True)
- captcha_image.write(imgStr)
- captcha_image.close()
+ if not self.account:
+ html = self.load("%s/free/" % self.pyfile.url, post={"dl_free":"1"}, cookies=True)
+ if re.search(r"/failure/full/1", self.req.lastEffectiveURL):
+ self.setWait(120)
+ self.log.debug("%s: no free slots, waiting 120 seconds" % (self.__name__))
+ self.wait()
+ self.retry()
+ captcha = self.decryptCaptcha("http://www.share-online.biz/captcha.php", get={"rand":"0.%s" % random.randint(10**15,10**16)}, cookies=True)
- # again fallback
- try:
- captcha = self.ocr.get_captcha(captcha_image.name)
- os.remove(captcha_image.name)
-
- except AttributeError:
- captcha = self.ocr.get_captcha(captcha_image_name)
- os.remove(captcha_image_name)
-
- self.logger.debug("%s Captcha %s: %s" % (self.__name__, i, captcha))
- sleep(3)
- self.html[1] = self.load(url, post={"captchacode": captcha}, cookies=True)
- if re.search(r"no slots available", self.html[1]):
- self.time_plus_wait = time() + 120
- self.logger.debug("%s: no free slots, waiting 120 seconds" % (self.__name__))
- return False
- if re.search(r"Der Download ist Ihnen zu langsam", self.html[1]):
- self.time_plus_wait = time() + 15
- return True
+ self.log.debug("%s Captcha: %s" % (self.__name__, captcha))
+ sleep(3)
+
+ html = self.load(self.pyfile.url, post={"captchacode": captcha}, cookies=True)
+ if re.search(r"Der Download ist Ihnen zu langsam", html):
+ #m = re.search("var timeout='(\d+)';", self.html[1])
+ #self.waitUntil = time() + int(m.group(1)) if m else 30
+ return True
- raise Exception("Captcha not decrypted")
+ self.retry()
else:
return True
-
- def get_file_url(self):
+
+ def convertURL(self):
+ self.pyfile.url = self.pyfile.url.replace("http://www.share-online.biz/download.php?id=", "http://www.share-online.biz/dl/")
+
+ def getFileUrl(self):
""" returns the absolute downloadable filepath
"""
- if not self.want_reconnect:
- file_url_pattern = 'loadfilelink\.decode\("([^"]+)'
- return b64decode(re.search(file_url_pattern, self.html[1]).group(1))
- else:
- return False
+ if self.account:
+ return b64decode(re.search('var dl="(.*?)"', self.html).group(1))
+ file_url_pattern = 'loadfilelink\.decode\("([^"]+)'
+ return b64decode(re.search(file_url_pattern, self.html).group(1))
- def check_file(self, local_file):
+ def checksum(self, local_file):
if self.api_data and self.api_data["checksum"]:
h = hashlib.md5()
f = open(local_file, "rb")