diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Hook.py | 2 | ||||
-rw-r--r-- | module/plugins/accounts/HellshareCz.py | 20 | ||||
-rw-r--r-- | module/plugins/crypter/FilesonicComFolder.py | 31 | ||||
-rw-r--r-- | module/plugins/crypter/LinkdecrypterCom.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/ExternalScripts.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 25 | ||||
-rw-r--r-- | module/plugins/hoster/BasePlugin.py | 59 | ||||
-rw-r--r-- | module/plugins/hoster/DepositfilesCom.py | 103 | ||||
-rw-r--r-- | module/plugins/hoster/HellshareCz.py | 123 | ||||
-rw-r--r-- | module/plugins/hoster/IfolderRu.py | 6 | ||||
-rw-r--r-- | module/plugins/hoster/LoadTo.py | 82 | ||||
-rw-r--r-- | module/plugins/hoster/RapidshareCom.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/ShareRapidCom.py | 15 | ||||
-rw-r--r-- | module/plugins/internal/UnRar.py | 31 |
14 files changed, 368 insertions, 139 deletions
diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 51ebd1aec..5efd08bae 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -129,7 +129,7 @@ class Hook(Base): def coreExiting(self): pass - def downloadStarts(self, pyfile): + def downloadPreparing(self, pyfile): pass def downloadFinished(self, pyfile): diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index eb44ee47f..fc44e9307 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.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 """ @@ -22,33 +22,33 @@ import re class HellshareCz(Account): __name__ = "HellshareCz" - __version__ = "0.1" + __version__ = "0.11" __type__ = "account" __description__ = """hellshare.cz account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - - CREDIT_LEFT_PATTERN = r'<a class="button-amount-1" href="/buy-credit/" title="Your current credit">([^<]+)</a>' + + CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+)</th>' def loadAccountInfo(self, user, req): self.relogin(user) html = req.load("http://www.hellshare.com/") - + found = re.search(self.CREDIT_LEFT_PATTERN, html) if found is None: credits = 0 else: credits = int(found.group(1)) * 1024 - + return {"validuntil": -1, "trafficleft": credits} - + def login(self, user, data, req): - + html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={ "login": "Log in", "password": data["password"], "username": user }) - + if "<p>You input a wrong user name or wrong password</p>" in html: - self.wrongPassword() + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/crypter/FilesonicComFolder.py b/module/plugins/crypter/FilesonicComFolder.py new file mode 100644 index 000000000..7bf1df381 --- /dev/null +++ b/module/plugins/crypter/FilesonicComFolder.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter + +class FilesonicComFolder(Crypter): + __name__ = "FilesonicComFolder" + __type__ = "crypter" + __pattern__ = r"http://(\w*\.)?(sharingmatrix|filesonic|wupload)\.[^/]*/folder/\d+/?" + __version__ = "0.10" + __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 decrypt(self, pyfile): + html = self.load(self.pyfile.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: + 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/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index befbfe4e6..e2fc55150 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -22,7 +22,7 @@ from module.plugins.Crypter import Crypter class LinkdecrypterCom(Crypter): __name__ = "LinkdecrypterCom" __type__ = "crypter" - __pattern__ = r"http://(\w*\.)?(10001mb\.com|123link\.it|1cl\.in|1kh\.de|1zh\.us|2joy\.de|2so\.be|3\.ly|5\.gp|6nc\.net|7li\.in|9\.bb|adf\.ly|adflav\.com|adfoc\.us|allanalpass\.com|alturl\.com|amy\.gs|any\.gs|apurl\.ru|aurl\.es|b23\.ru|baberepublic\.com|bat5\.com|bax\.li|beam\.to|bit\.ly|blu\.cc|c\.ly|capourl\.com|cc\.st|cd\.vg|cloneurl\.com|convertircodigo\.com|crypt-it\.com|crypt\.to|cryptlink\.ws|deb\.gs|digzip\.com|djurl\.com|dl-protect\.com|dl\.dropbox\.com|doiop\.com|ehe\.me|embedupload\.com|encript\.in|encurtador\.com|enlacs\.com|evg\.in|extreme-protect\.com|fa\.by|faja\.me|fapoff\.com|fdnlinks\.com|fea\.me|fff\.to|filedeck\.net|filemirrorupload\.com|fileupster\.com|flameupload\.com|freetexthost\.com|fwd4\.me|fyad\.org|goandgrab\.info|goblig\.com|goo\.gl|h-url\.in|hasurl\.co\.cc|hide-url\.net|hidemyass\.com|hides\.at|hideurl\.biz|ho\.io|hornywood\.tv|href\.hu|id2\.tryjav\.com|ilix\.in|ily\.me|ino\.me|interupload\.com|is\.gd|ivpaste\.com|j\.mp|je\.pl|jheberg\.com|just\.as|kickupload\.com|klnk\.de|knoffl\.com|kodo\.ameoto\.com|ks\.gs|latwy\.pl|link-go\.info|link-protector\.com|link-safe\.net|link4jo\.com|linkanonimo\.com|linkbabes\.com|linkbank\.eu|linkbee\.com|linkblur\.com|linkbucks\.com|linkcrypt\.com|linkcrypt\.ws|linkencrypter\.com|linkhide\.com\.ar|linkhide\.in|linkoculto\.net|linkok\.org|linkprivado\.com|linkprivate\.net|linkprotect\.in|links-protect\.com|links-protect\.info|links\.tc|linksafe\.me|linksaver\.info|linkse\.info|linkseguro\.com\.ar|linkseguro\.org|linksole\.com|linksprotegidos\.info|linkto\.net|linkweb\.dk|linkx\.in|linkzip\.net|listedfiles\.com|littleurl\.net|lixk\.me|ljv2\.com|ll11\.org|lnk\.cm|lnk\.co|longr\.us|lovelink\.in|mcaf\.ee|megaline\.co|megaupper\.com|mhz\.me|migre\.me|miniurls\.co|minu\.me|mir\.cr|mirrorcreator\.com|mo\.by|multi-uploadeur\.com|multiupload\.com|murl\.kz|musicalmente\.info|mypaqe\.com|mypl\.us|myrapidlinks\.com|myref\.de|myurl\.in|nbanews\.us|okconsolas\.com|oneddl\.canhaz\.it|ow\.ly|p4p\.com\.es|p6l\.org|paste\.frubar\.net|paste\.hotfile-bb\.com|paste\.ubuntu\.com|paste2\.org|paste21\.info|pastebin\.com|paylesssofts\.net|poontown\.net|pqueno\.com|priva\.us|protec-link\.com|protect-ddl\.com|protect-my-links\.com|protected\.socadvnet\.com|protectlinks\.com|protectlinks\.net|protectlk\.com|protege-mes-liens\.com|ptl\.li|qooy\.com|qqc\.co|qvvo\.com|rapidfolder\.com|rapidsafe\.de|rapidsafe\.org|rapidshare\.mu|realfiles\.net|redir\.ec|ref\.so|relinka\.net|rexwo\.com|rqq\.co|rs-layer\.com|rsmonkey\.com|s2l\.biz|saf\.li|safe\.mn|safelinking\.net|saferlinks\.com|sealed\.in|seclnk\.in|seriousfiles\.com|sharebee\.com|short-link\.fr|shortlink\.ca|shorturlscript\.net|simurl\.com|sinl\.es|skroc\.pl|slexy\.org|slnky\.net|smsdl\.com|sn\.im|sonofertas\.es|spedr\.com|spreadlink\.us|star-cyber\.com|subedlc\.com|subirfacil\.com|syl\.me|szort\.pl|takemyfile\.com|takemylinks\.com|textsnip\.com|thecow\.me|thesefiles\.com|tilien\.net|tiny\.cc|tiny\.lt|tinylinks\.co|tinypaste\.com|tinyurl\.com|tinyurlscript\.info|tmf\.myegy\.com|togoto\.us|tot\.to|tra\.kz|u\.to|uberpicz\.com|ulinks\.net|ultra-protect\.com|ultrafiles\.net|undeadlink\.com|uploadjockey\.com|uploadmirrors\.com|uploadonall\.com|upmirror\.com|upsafe\.org|ur\.ly|url-go\.com|url-site\.com|url4t\.com|urla\.in|urlbeat\.net|urlcash\.net|urlcrypt\.com|urlcut\.com|urlcut\.in|urldefender\.com|urln\.tk|urlpulse\.net|urlspy\.co\.cc|urwij|uselink\.info|uucc\.cc|uze\.in|wcrypt\.in|webtooljungle\.com|weepax\.com|whackyvidz\.com|x-ls\.ru|x\.co|xa\.ly|xc\.io|xr\.com|xtreemhost\.com|xurl\.cn|xxs\.ru|ysu\.me|yyv\.co|zff\.co|zio\.in|zpag\.es)/.*" + __pattern__ = r"http://(\w*\.)?(10001mb\.com|123link\.it|1cl\.in|1kh\.de|1zh\.us|2joy\.de|2so\.be|3\.ly|5\.gp|6nc\.net|7li\.in|9\.bb|adf\.ly|adflav\.com|adfoc\.us|allanalpass\.com|alturl\.com|amy\.gs|any\.gs|apurl\.ru|aurl\.es|b23\.ru|baberepublic\.com|bat5\.com|bax\.li|beam\.to|bit\.ly|blu\.cc|c\.ly|capourl\.com|cc\.st|cd\.vg|cloneurl\.com|convertircodigo\.com|crypt-it\.com|crypt\.to|cryptlink\.ws|deb\.gs|digzip\.com|djurl\.com|dl-protect\.com|doiop\.com|ehe\.me|embedupload\.com|encript\.in|encurtador\.com|enlacs\.com|evg\.in|extreme-protect\.com|fa\.by|faja\.me|fapoff\.com|fdnlinks\.com|fea\.me|fff\.to|filedeck\.net|filemirrorupload\.com|fileupster\.com|flameupload\.com|freetexthost\.com|fwd4\.me|fyad\.org|goandgrab\.info|goblig\.com|goo\.gl|h-url\.in|hasurl\.co\.cc|hide-url\.net|hidemyass\.com|hides\.at|hideurl\.biz|ho\.io|hornywood\.tv|href\.hu|id2\.tryjav\.com|ilix\.in|ily\.me|ino\.me|interupload\.com|is\.gd|ivpaste\.com|j\.mp|je\.pl|jheberg\.com|just\.as|kickupload\.com|klnk\.de|knoffl\.com|kodo\.ameoto\.com|ks\.gs|latwy\.pl|link-go\.info|link-protector\.com|link-safe\.net|link4jo\.com|linkanonimo\.com|linkbabes\.com|linkbank\.eu|linkbee\.com|linkblur\.com|linkbucks\.com|linkcrypt\.com|linkcrypt\.ws|linkencrypter\.com|linkhide\.com\.ar|linkhide\.in|linkoculto\.net|linkok\.org|linkprivado\.com|linkprivate\.net|linkprotect\.in|links-protect\.com|links-protect\.info|links\.tc|linksafe\.me|linksaver\.info|linkse\.info|linkseguro\.com\.ar|linkseguro\.org|linksole\.com|linksprotegidos\.info|linkto\.net|linkweb\.dk|linkx\.in|linkzip\.net|listedfiles\.com|littleurl\.net|lixk\.me|ljv2\.com|ll11\.org|lnk\.cm|lnk\.co|longr\.us|lovelink\.in|mcaf\.ee|megaline\.co|megaupper\.com|mhz\.me|migre\.me|miniurls\.co|minu\.me|mir\.cr|mirrorcreator\.com|mo\.by|multi-uploadeur\.com|multiupload\.com|murl\.kz|musicalmente\.info|mypaqe\.com|mypl\.us|myrapidlinks\.com|myref\.de|myurl\.in|nbanews\.us|okconsolas\.com|oneddl\.canhaz\.it|ow\.ly|p4p\.com\.es|p6l\.org|paste\.frubar\.net|paste\.hotfile-bb\.com|paste\.ubuntu\.com|paste2\.org|paste21\.info|pastebin\.com|paylesssofts\.net|poontown\.net|pqueno\.com|priva\.us|protec-link\.com|protect-ddl\.com|protect-my-links\.com|protected\.socadvnet\.com|protectlinks\.com|protectlinks\.net|protectlk\.com|protege-mes-liens\.com|ptl\.li|qooy\.com|qqc\.co|qvvo\.com|rapidfolder\.com|rapidsafe\.de|rapidsafe\.org|rapidshare\.mu|realfiles\.net|redir\.ec|ref\.so|relinka\.net|rexwo\.com|rqq\.co|rs-layer\.com|rsmonkey\.com|s2l\.biz|saf\.li|safe\.mn|safelinking\.net|saferlinks\.com|sealed\.in|seclnk\.in|seriousfiles\.com|sharebee\.com|short-link\.fr|shortlink\.ca|shorturlscript\.net|simurl\.com|sinl\.es|skroc\.pl|slexy\.org|slnky\.net|smsdl\.com|sn\.im|sonofertas\.es|spedr\.com|spreadlink\.us|star-cyber\.com|subedlc\.com|subirfacil\.com|syl\.me|szort\.pl|takemyfile\.com|takemylinks\.com|textsnip\.com|thecow\.me|thesefiles\.com|tilien\.net|tiny\.cc|tiny\.lt|tinylinks\.co|tinypaste\.com|tinyurl\.com|tinyurlscript\.info|tmf\.myegy\.com|togoto\.us|tot\.to|tra\.kz|u\.to|uberpicz\.com|ulinks\.net|ultra-protect\.com|ultrafiles\.net|undeadlink\.com|uploadjockey\.com|uploadmirrors\.com|uploadonall\.com|upmirror\.com|upsafe\.org|ur\.ly|url-go\.com|url-site\.com|url4t\.com|urla\.in|urlbeat\.net|urlcash\.net|urlcrypt\.com|urlcut\.com|urlcut\.in|urldefender\.com|urln\.tk|urlpulse\.net|urlspy\.co\.cc|urwij|uselink\.info|uucc\.cc|uze\.in|wcrypt\.in|webtooljungle\.com|weepax\.com|whackyvidz\.com|x-ls\.ru|x\.co|xa\.ly|xc\.io|xr\.com|xtreemhost\.com|xurl\.cn|xxs\.ru|ysu\.me|yyv\.co|zff\.co|zio\.in|zpag\.es)/.*" __version__ = "0.2" __description__ = """linkdecrypter.com""" __author_name__ = ("zoidberg") @@ -80,4 +80,4 @@ class LinkdecrypterCom(Crypter): else: self.fail('Could not extract any links') -
\ No newline at end of file + diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index e8d929b71..2e77f1dae 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -79,7 +79,7 @@ class ExternalScripts(Hook): except Exception, e: self.logError(_("Error in %(script)s: %(error)s") % { "script" :basename(script), "error": str(e)}) - def downloadStarts(self, pyfile): + def downloadPreparing(self, pyfile): for script in self.scripts['download_preparing']: self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.id) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index d48496c14..74721d166 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -66,6 +66,9 @@ class WrongPassword(Exception): class ExtractArchive(Hook): + """ + Provides: unrarFinished (folder, filename) + """ __name__ = "ExtractArchive" __version__ = "0.1" __description__ = "Extract different kind of archives" @@ -95,6 +98,14 @@ class ExtractArchive(Hook): names.append(p) self.plugins.append(klass) + except OSError, e: + if e.errno == 2: + self.logInfo(_("No %s installed") % p) + else: + self.logWarning(_("Could not activate %s") % p, str(e)) + if self.core.debug: + print_exc() + except Exception, e: self.logWarning(_("Could not activate %s") % p, str(e)) if self.core.debug: @@ -140,6 +151,7 @@ class ExtractArchive(Hook): #iterate packages -> plugins -> targets for pid in ids: p = self.core.files.getPackage(pid) + self.logInfo(_("Check package %s") % p.name) if not p: continue # determine output folder @@ -148,7 +160,8 @@ class ExtractArchive(Hook): if self.getConfig("destination") and self.getConfig("destination").lower() != "none": if exists(self.getConfig("destination")): - out = save_join(self.getConfig("destination"), "") + out = save_join(dl, p.folder, self.getConfig("destination"), "") + #relative to package folder if destination is relative, otherwise absolute path overwrites them files_ids = [(save_join(dl, p.folder, x["name"]), x["id"]) for x in p.getChildren().itervalues()] @@ -158,7 +171,7 @@ class ExtractArchive(Hook): for plugin in self.plugins: targets = plugin.getTargets(files_ids) - self.logDebug("Targets: %s" % targets) + if targets: self.logDebug("Targets: %s" % targets) for target, fid in targets: if target in extracted: self.logDebug(basename(target), "skipped") @@ -201,12 +214,12 @@ class ExtractArchive(Hook): else: self.logInfo(basename(plugin.file), _("Password protected")) self.logDebug("Passwords: %s" % str(passwords)) - + pwlist = copy(self.getPasswords()) #remove already supplied pws from list (only local) for pw in passwords: if pw in pwlist: pwlist.remove(pw) - + for pw in passwords + pwlist: try: self.logDebug("Try password: %s" % pw) @@ -233,7 +246,7 @@ class ExtractArchive(Hook): else: self.logDebug("%s does not exists" % f) self.logInfo(basename(plugin.file), _("Extracting finished")) - self.core.hookManager.unrarFinished(plugin.out, plugin.file) + self.manager.dispatchEvent("unrarFinished", plugin.out, plugin.file) return plugin.getExtractedFiles() @@ -327,7 +340,7 @@ class AbtractExtractor: def __init__(self, m, file, out, fullpath, overwrite, renice): - """Initialize extractor for specifiy file + """Initialize extractor for specific file :param m: ExtractArchive Hook plugin :param file: Absolute filepath diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 71c61942f..15e35ce24 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -1,21 +1,24 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from urlparse import urlparse +from re import search +from urllib import unquote -import re +from module.network.HTTPRequest import BadHeader from module.plugins.Hoster import Hoster -from module.utils import html_unescape +from module.utils import html_unescape, removeChars class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" __pattern__ = r"^unmatchable$" - __version__ = "0.11" + __version__ = "0.14" __description__ = """Base Plugin when any other didnt fit""" __author_name__ = ("RaNaN") __author_mail__ = ("RaNaN@pyload.org") def setup(self): - self.chunkLimit = 3 + self.chunkLimit = -1 self.resumeDownload = True def process(self, pyfile): @@ -39,8 +42,48 @@ class BasePlugin(Hoster): # return if pyfile.url.startswith("http"): - pyfile.name = html_unescape(re.findall("([^/=]+)", pyfile.url)[-1]) - self.download(pyfile.url, disposition=True) - + try: + self.downloadFile(pyfile) + except BadHeader, e: + 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)")) + + self.req.addAuth(pwd) + self.downloadFile(pyfile) + else: + raise + + else: + self.fail("No Plugin matched and not a downloadable url.") + + + def downloadFile(self, pyfile): + header = self.load(pyfile.url, just_header = True) + #self.logDebug(header) + + if 'location' in header: + self.logDebug("Location: " + header['location']) + url = unquote(header['location']) else: - self.fail("No Plugin matched and not a downloadable url.")
\ No newline at end of file + url = pyfile.url + + name = html_unescape(urlparse(url).path.split("/")[-1]) + + if 'content-disposition' in header: + self.logDebug("Content-Disposition: " + header['content-disposition']) + m = search("filename(?P<type>=|\*=(?P<enc>.+)'')(?P<name>.*)", header['content-disposition']) + if m: + disp = m.groupdict() + self.logDebug(disp) + if not disp['enc']: disp['enc'] = 'utf-8' + name = removeChars(disp['name'], "\"';").strip() + name = unicode(unquote(name), disp['enc']) + + if not name: name = url + pyfile.name = name + self.logDebug("Filename: %s" % pyfile.name) + self.download(url, disposition=True)
\ No newline at end of file diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 4f2cc9fc4..81e6aa4d6 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -4,37 +4,64 @@ import re import urllib from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL +from module.plugins.ReCaptcha import ReCaptcha + +def getInfo(urls): + result = [] + + for url in urls: + html = getURL(re.sub(r"\.com(/.*?)?/files", ".com/en/files", url), decode=True) + if re.search(DepositfilesCom.FILE_OFFLINE_PATTERN, html): + # File offline + result.append((url, 0, 1, url)) + else: + # Get file info + name, size = url, 0 + + found = re.search(DepositfilesCom.FILE_INFO_PATTERN, html) + if found is not None: + name, size, units = found.groups() + size = float(size) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[units] + result.append((name, size, 2, url)) + yield result class DepositfilesCom(Hoster): __name__ = "DepositfilesCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?depositfiles\.com(/\w{1,3})?/files/[\w]+" - __version__ = "0.32" + __version__ = "0.34" __description__ = """Depositfiles.com Download Hoster""" - __author_name__ = ("spoob") - __author_mail__ = ("spoob@pyload.org") + __author_name__ = ("spoob", "zoidberg") + __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") + + FILE_INFO_PATTERN = r'File name: <b title="([^"]+)">.*\s*<span class="nowrap">File size: <b>([0-9.]+) (KB|MB|GB)</b>' + FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>' + RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)', this\);" + DOWNLOAD_LINK_PATTERN = r'<form action="(http://.+?\.depositfiles.com/.+?)" method="get"' def setup(self): self.resumeDownload = self.multiDL = True if self.account else False - self.pyfile.url = re.sub(r"\.com(/.*?)?/files", ".com/de/files", self.pyfile.url) - + self.pyfile.url = re.sub(r"\.com(/.*?)?/files", ".com/en/files", self.pyfile.url) + def process(self, pyfile): if re.search(r"(.*)\.html", self.pyfile.url): self.pyfile.url = re.search(r"(.*)\.html", self.pyfile.url).group(1) - self.html = self.load(self.pyfile.url, cookies=True if self.account else False) - - if '<span class="html_download_api-not_exists"></span>' in self.html: + self.html = self.load(self.pyfile.url, cookies=True if self.account else False, decode = True) + + if self.FILE_OFFLINE_PATTERN in self.html: self.offline() - - - - return_url = self.req.lastEffectiveURL.split("/", 3)[3] - self.html = self.load(r'http://depositfiles.com/switch_lang.php?return_url=%s&lang=de' % return_url) - pyfile.name = re.search('(?s)Dateiname: <b title=\"(.*?)\">.*?</b>', self.html).group(1) + pyfile.name, size, units = re.search(self.FILE_INFO_PATTERN, self.html).groups() + pyfile.size = float(size) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[units] + self.logDebug ("FILENAME: %s" % pyfile.name) + #return_url = self.req.lastEffectiveURL.split("/", 3)[3] + #self.html = self.load(r'http://depositfiles.com/switch_lang.php?return_url=%s&lang=en' % return_url) + + #pyfile.name = re.search('(?s)Dateiname: <b title=\"(.*?)\">.*?</b>', self.html).group(1) if self.account: self.handlePremium() @@ -50,7 +77,7 @@ class DepositfilesCom(Hoster): self.setWait(61) self.wait() self.retry() - + wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html) if wait: wait_time = int(wait.group(1)) @@ -70,20 +97,44 @@ class DepositfilesCom(Hoster): if wait: self.setWait(int(wait.group(1))) - self.wait() - - form = re.search(r"\$\('#download_container'\)\.load\('([^']+)", self.html) + found = re.search(r"var fid = '(\w+)';", self.html) + if not found: self.retry(wait_time=5) + params = {'fid' : found.group(1)} + self.logDebug ("FID: %s" % params['fid']) - self.html = self.load("http://depositfiles.com/"+ form.group(1)) + captcha_key = None + found = re.search(self.RECAPTCHA_PATTERN, self.html) + if found: captcha_key = found.group(1) + self.logDebug ("CAPTCHA_KEY: %s" % captcha_key) - link = urllib.unquote(re.search('<form action="(http://.+?\.depositfiles.com/.+?)" method="get"', self.html).group(1)) - self.download(link) + self.wait() + recaptcha = ReCaptcha(self) + + for i in range(5): + self.html = self.load("http://depositfiles.com/get_file.php", get = params) + if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: + if not captcha_key: self.fail('Parse error (Captcha key)') + if 'response' in params: self.invalidCaptcha() + params['challenge'], params['response'] = recaptcha.challenge(captcha_key) + self.logDebug(params) + continue + + found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + if found: + if 'response' in params: self.correctCaptcha() + link = urllib.unquote(found.group(1)) + self.logDebug ("LINK: %s" % link) + break + else: + self.fail('Parse error (Download link)') + else: + self.fail('No valid captcha response received') - - #wait_time = int(re.search(r'<span id="download_waiter_remain">(.*?)</span>', self.html).group(1)) - #self.setWait(wait_time) - #self.log.debug("DepositFiles.com: Waiting %d seconds." % wait_time) + try: + self.download(link) + except: + self.retry(wait_time = 60) def handlePremium(self): link = urllib.unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1)) - self.download(link) + self.download(link)
\ No newline at end of file diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 7ff5e5367..8c90e8099 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -31,94 +31,94 @@ def getInfo(urls): result.append((url, 0, 1, url)) else: # Get file info + found = re.search(HellshareCz.FILE_SIZE_PATTERN, html) + if found is not None: + size, units = found.groups() + size = float(size) * 1024 ** {'kB': 1, 'KB': 1, 'MB': 2, 'GB': 3}[units] + found = re.search(HellshareCz.FILE_NAME_PATTERN, html) if found is not None: name = found.group(1) + + if found or size > 0: result.append((name, 0, 2, url)) yield result - class HellshareCz(Hoster): __name__ = "HellshareCz" __type__ = "hoster" __pattern__ = r"http://(.*\.)*hellshare\.(cz|com|sk|hu)/.*" - __version__ = "0.6" + __version__ = "0.71" __description__ = """Hellshare.cz""" __author_name__ = ("zoidberg") - FREE_URL_PATTERN = r'<a id="button-download-free" href="([^"]*)"' - PREMIUM_URL_PATTERN = r'<a onclick="return launchFullDownload[^>]*href="(http://[^/]+/([^/]+)/[^"]+)" target="full-download-iframe">' - FILE_NAME_PATTERN = r'<strong id="FileName_master">([^<]+)</strong>' - FILE_OFFLINE_PATTERN = r'<h1>Soubor nenalezen</h1>' - SERVER_PATTERN = r'<form method="post" action="([^"]+)">' - CAPTCHA_PATTERN = r'<p class="text-center marg-off"><img id="captcha-img" class="va-middle" src="([^"]+)"' - FILE_CREDITS_PATTERN = r'<strong style="font-size:20px;">(\d+)\s*credits</strong>' - CREDIT_LEFT_PATTERN = r'<a class="button-amount-1" href="[^>]*/buy-credit/" title="Your current credit">([^<]+)</a>' - DOWNLOAD_AGAIN_PATTERN = r'Soubor jste ji. stahoval - opakovan. download prob.hne zdarma. Pokra.ovat' + FREE_URL_PATTERN = r'<h3>I\'ll wait.*\s*<form action="([^"]*)"' + PREMIUM_URL_PATTERN = r"launchFullDownload\('([^']*)'\);" + FILE_NAME_PATTERN = r'<h1 id="filename">([^<]+)</h1>' + FILE_SIZE_PATTERN = r'<td><span>Size</span></td>\s*<th><span>([0-9.]*) (kB|KB|MB|GB)</span></th>' + 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>' def setup(self): self.resumeDownload = self.multiDL = True if self.account else False self.chunkLimit = 1 def process(self, pyfile): - if self.premium and self.account is not None: + if self.account: self.account.relogin(self.user) - self.getFileInfo(pyfile) + + pyfile.url = re.search(r'([^?]*)', pyfile.url).group(1) + self.html = self.load(pyfile.url, get = {"do" : "fileDownloadButton-showDownloadWindow"}, decode=True) + self.getFileInfo(pyfile) + + if self.account: self.handlePremium() else: - self.getFileInfo(pyfile) self.handleFree() def getFileInfo(self, pyfile): - self.html = self.load(pyfile.url, decode=True) - #marks the file as "offline" when the pattern was found on the html-page if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: self.offline() - # parse the name from the site and set attribute in pyfile + # parse the name from the site and set attribute in pyfile found = re.search(self.FILE_NAME_PATTERN, self.html) if found is None: self.fail("Parse error (Filename") pyfile.name = found.group(1) - def handleFree(self): - # parse free download url - found = re.search(self.FREE_URL_PATTERN, self.html) - if found is None: - self.fail("Parse error (URL)") - - parsed_url = found.group(1) + found = re.search(self.FILE_SIZE_PATTERN, self.html) + if found is not None: + size, units = found.groups() + pyfile.size = float(size) * 1024 ** {'kB': 1, 'KB': 1, 'MB': 2, 'GB': 3}[units] - if parsed_url == "": + 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() - # get download ticket and parse html - self.logDebug("PARSED_URL:" + parsed_url) - self.html = self.load(parsed_url) - - found = re.search(self.SERVER_PATTERN, self.html) - if found is None: - self.fail("Parse error (Server)") - download_url = found.group(1) + # parse free download url + found = re.search(self.FREE_URL_PATTERN, self.html) + if found is None: self.fail("Parse error (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.fail("Parse error (Captcha)") + if found is None: self.fail("Parse error (Captcha)") captcha_url = found.group(1) - # get and decrypt captcha captcha = self.decryptCaptcha(captcha_url) self.logDebug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + captcha) - # download the file, destination is determined by pyLoad - self.download(download_url, post={ - "captcha": captcha - }) + self.download(parsed_url, post = {"captcha" : captcha, "submit" : "Download"}) # check download check = self.checkDownload({ @@ -130,32 +130,31 @@ class HellshareCz(Hoster): self.retry() def handlePremium(self): - found = re.search(self.FILE_CREDITS_PATTERN, self.html) - if found is None: - self.fail("Parse error (Credits)") - file_credits = int(found.group(1)) - - found = re.search(self.CREDIT_LEFT_PATTERN, self.html) - if found is None: - self.fail("Parse error (Credits left)") - credits_left = int(found.group(1)) + # 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) - self.logInfo("Premium download for %i credits" % file_credits) - self.logInfo("User %s has %i credits left" % (self.user, credits_left)) + # 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.fail("Not enough credit left. Trying to download as free user.") + self.resetAccount() + credits_left = int(found.group(1)) - if file_credits > credits_left and not re.search(self.DOWNLOAD_AGAIN_PATTERN, self.html): - self.resetAccount() + found = re.search(self.FILE_CREDITS_PATTERN, self.html) + if found: + self.file_credits = found.group(1) + else: + self.logError("Parse error: file credits") + self.file_credits = "???" - found = re.search(self.PREMIUM_URL_PATTERN, self.html) - if found is None: - self.fail("Parse error (URL)") - download_url = found.group(1) + self.logInfo("Downloading file for %s credits, %d credits left" % (self.file_credits, credits_left)) self.download(download_url) info = self.account.getAccountInfo(self.user, True) - self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024)) - - - - + self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024))
\ No newline at end of file diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 063ebfbff..c0e45a87a 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -45,14 +45,14 @@ class IfolderRu(Hoster): __name__ = "IfolderRu" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)?ifolder.ru/(\d+).*" - __version__ = "0.3" + __version__ = "0.31" __description__ = """ifolder.ru""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - FILE_NAME_PATTERN = ur'^\s*(?:<div><span>)?Название:(?:</span>)? <b>([^<]+)</b><(?:/div|br)>' - FILE_SIZE_PATTERN = ur'^\s*(?:<div><span>)?Размер:(?:</span>)? <b>([0-9.]+) ([^<]+)</b><(?:/div|br)>' + FILE_NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>([^<]+)</b><(?:/div|br)>' + FILE_SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>([0-9.]+) ([^<]+)</b><(?:/div|br)>' SESSION_ID_PATTERN = r'<a href=(http://ints.ifolder.ru/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>' FORM1_PATTERN = r'<form method=post name="form1" ID="Form1" style="margin-bottom:200px">(.*?)</form>' FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py new file mode 100644 index 000000000..b1204cb2d --- /dev/null +++ b/module/plugins/hoster/LoadTo.py @@ -0,0 +1,82 @@ +# -*- 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: halfman +""" + +import re +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): + result = [] + + for url in urls: + + html = getURL(url, decode=True) + if re.search(LoadTo.FILE_OFFLINE_PATTERN, html): + # File offline + result.append((url, 0, 1, url)) + else: + # Get file info + name = re.search(LoadTo.FILE_NAME_PATTERN, html) + size = re.search(LoadTo.SIZE_PATTERN, html) + if name is not None: + name = name.group(1) + size = size.group(1) + result.append((name, size, 2, url)) + yield result + +class LoadTo(Hoster): + __name__ = "LoadTo" + __type__ = "hoster" + __pattern__ = r"http://.*load.to/.*" + __version__ = "0.1" + __description__ = """load.to""" + __author_name__ = ("halfman") + __author_mail__ = ("Pulpan3@gmail.com") + + FILE_NAME_PATTERN = r'<div class="toolarge"><h1>([^<]+)</h1></div>' + URL_PATTERN = r'<form method="post" action="([^"]+)"' + SIZE_PATTERN = r'<div class="download_table_right">(\d+) Bytes</div>' + FILE_OFFLINE_PATTERN = r'Can\'t find file. Please check URL.<br />' + WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"' + + def setup(self): + self.multiDL = False + + def process(self, pyfile): + + self.html = self.load(pyfile.url, decode=True) + + if re.search(self.FILE_OFFLINE_PATTERN, self.html): + self.offline() + + timmy = re.search(self.WAIT_PATTERN, self.html) + if timmy: + self.setWait(timmy.group(1)) + self.wait() + + found = re.search(self.FILE_NAME_PATTERN, self.html) + if found is None: + self.fail("Parse error (NAME)") + pyfile.name = found.group(1) + + found = re.search(self.URL_PATTERN, self.html) + if found is None: + self.fail("Parse error (URL)") + download_url = found.group(1) + + self.download(download_url)
\ No newline at end of file diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index c9aba7898..0d927c525 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -50,7 +50,7 @@ class RapidshareCom(Hoster): __name__ = "RapidshareCom" __type__ = "hoster" __pattern__ = r"https?://[\w\.]*?rapidshare.com/(?:files/(?P<id>\d*?)/(?P<name>[^?]+)|#!download\|(?:\w+)\|(?P<id_new>\d+)\|(?P<name_new>[^|]+))" - __version__ = "1.36" + __version__ = "1.37" __description__ = """Rapidshare.com Download Hoster""" __config__ = [["server", "Cogent;Deutsche Telekom;Level(3);Level(3) #2;GlobalCrossing;Level(3) #3;Teleglobe;GlobalCrossing #2;TeliaSonera #2;Teleglobe #2;TeliaSonera #3;TeliaSonera", "Preferred Server", "None"]] __author_name__ = ("spoob", "RaNaN", "mkaay") @@ -103,6 +103,8 @@ class RapidshareCom(Hoster): elif self.api_data["status"] in ("0","4","5"): self.offline() + elif self.api_data["status"] == "3": + self.tempOffline() else: self.fail("Unknown response code.") diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index ce1912d38..46818a84c 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -4,6 +4,7 @@ import re from pycurl import HTTPHEADER from module.network.RequestFactory import getRequest +from module.network.HTTPRequest import BadHeader from module.plugins.Hoster import Hoster def getInfo(urls): @@ -41,8 +42,8 @@ def getInfo(urls): class ShareRapidCom(Hoster): __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)/.*" - __version__ = "0.4" + __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.42" __description__ = """Share-rapid.com plugin - premium only""" __author_name__ = ("MikyWoW", "zoidberg") __author_mail__ = ("MikyWoW@seznam.cz", "zoidberg@mujmail.cz") @@ -61,14 +62,20 @@ class ShareRapidCom(Hoster): def process(self, pyfile): if not self.account: self.fail("User not logged in") + url = "http://share-rapid.com/" + re.search(self.__pattern__, pyfile.url).groups()[-1] + self.logDebug("URL: " + url) - self.html = self.load(pyfile.url, decode=True) + try: + self.html = self.load(url, decode=True) + except BadHeader, e: + self.account.relogin(self.user) + self.retry(3, 0, str(e)) + size, units = re.search(self.FILE_SIZE_PATTERN, self.html).groups() pyfile.size = float(size) * 1024 ** {'kB': 1, 'MB': 2, 'GB': 3}[units] found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) if found is not None: - self.logDebug(found) link, pyfile.name = found.groups() self.logInfo("Downloading file: %s (%s %s)" % (pyfile.name, size, units)) self.logInfo("Premium link: %s" % link) diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 3f27c2e9e..1943f69e0 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -18,16 +18,14 @@ """ import os +import re from os.path import join from glob import glob from subprocess import Popen, PIPE - from module.plugins.hooks.ExtractArchive import AbtractExtractor from module.utils import save_join, decode -import re - class UnRar(AbtractExtractor): __name__ = "UnRar" __version__ = "0.1" @@ -36,16 +34,25 @@ class UnRar(AbtractExtractor): re_splitfile = re.compile(r"(.*)\.part(\d+)\.rar$") re_filelist = re.compile(r"(.+)\s+(\d+)\s+(\d+)\s+") re_wrongpwd = re.compile("(Corrupt file or wrong password|password incorrect)") + CMD = "unrar" @staticmethod def checkDeps(): if os.name == "nt": - cmd = join(pypath, "UnRAR.exe") + UnRar.CMD = join(pypath, "UnRAR.exe") + p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE) + p.communicate() else: - cmd = "unrar" + try: + p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE) + p.communicate() + except OSError: + + #fallback to rar + UnRar.CMD = "rar" + p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE) + p.communicate() - p = Popen([cmd], stdout=PIPE, stderr=PIPE) - p.communicate() return True @staticmethod @@ -129,7 +136,7 @@ class UnRar(AbtractExtractor): def getDeleteFiles(self): if ".part" in self.file: - return glob(self.file.replace("0", "*").replace("1", "*")) + return glob(re.sub("(?<=\.part)([01]+)", "*", self.file, re.IGNORECASE)) return [self.file] def listContent(self): @@ -153,13 +160,7 @@ class UnRar(AbtractExtractor): def call_unrar(self, command, *xargs, **kwargs): - if os.name == "nt": - cmd = join(pypath, "UnRAR.exe") - else: - cmd = "unrar" - args = [] - #overwrite flag args.append("-o+") if self.overwrite else args.append("-o-") @@ -174,7 +175,7 @@ class UnRar(AbtractExtractor): #NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue - call = [cmd, command] + args + list(xargs) + call = [self.CMD, command] + args + list(xargs) self.m.logDebug(" ".join(call)) p = Popen(call, stdout=PIPE, stderr=PIPE) |