diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-13 23:47:36 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-13 23:47:36 +0100 |
commit | bdfa8104065831bf0eb2f6a022552e8de725ed47 (patch) | |
tree | 4a43864e1bb257c7737a765d62899244b825a859 /module/plugins | |
parent | [themes] Tiny code cosmetics (diff) | |
parent | [Plugin] Some fixes by rlindner81 (diff) | |
download | pyload-bdfa8104065831bf0eb2f6a022552e8de725ed47.tar.xz |
Merge branch 'stable' into 0.4.10
Conflicts:
module/plugins/accounts/MegaRapidCz.py
module/plugins/accounts/ShareRapidCom.py
module/plugins/crypter/HotfileComFolder.py
module/plugins/crypter/HotfileFolderCom.py
module/plugins/hoster/Keep2shareCC.py
module/plugins/hoster/Keep2shareCc.py
module/plugins/hoster/MegaCoNz.py
module/plugins/hoster/MegaNz.py
module/plugins/hoster/MegaRapidCz.py
module/plugins/hoster/ShareRapidCom.py
module/plugins/internal/CaptchaService.py
pyload/api/__init__.py
pyload/manager/AccountManager.py
pyload/manager/PluginManager.py
pyload/manager/thread/PluginThread.py
pyload/network/HTTPRequest.py
pyload/network/XDCCRequest.py
pyload/plugins/Plugin.py
pyload/plugins/account/BillionuploadsCom.py
pyload/plugins/account/CramitIn.py
pyload/plugins/account/EasybytezCom.py
pyload/plugins/account/FastshareCz.py
pyload/plugins/account/File4safeCom.py
pyload/plugins/account/FileParadoxIn.py
pyload/plugins/account/FileomCom.py
pyload/plugins/account/FilerNet.py
pyload/plugins/account/FilerioCom.py
pyload/plugins/account/FourSharedCom.py
pyload/plugins/account/Ftp.py
pyload/plugins/account/Http.py
pyload/plugins/account/HugefilesNet.py
pyload/plugins/account/HundredEightyUploadCom.py
pyload/plugins/account/LomafileCom.py
pyload/plugins/account/MovReelCom.py
pyload/plugins/account/MultishareCz.py
pyload/plugins/account/MyfastfileCom.py
pyload/plugins/account/NosuploadCom.py
pyload/plugins/account/NovafileCom.py
pyload/plugins/account/QuickshareCz.py
pyload/plugins/account/RarefileNet.py
pyload/plugins/account/RyushareCom.py
pyload/plugins/account/SecureUploadEu.py
pyload/plugins/account/SendmywayCom.py
pyload/plugins/account/ShareRapidCom.py
pyload/plugins/account/StahnuTo.py
pyload/plugins/account/StreamcloudEu.py
pyload/plugins/account/TusfilesNet.py
pyload/plugins/account/UploadingCom.py
pyload/plugins/account/UptoboxCom.py
pyload/plugins/account/VidPlayNet.py
pyload/plugins/addon/Checksum.py
pyload/plugins/addon/ClickAndLoad.py
pyload/plugins/addon/DeleteFinished.py
pyload/plugins/addon/DownloadScheduler.py
pyload/plugins/addon/ExternalScripts.py
pyload/plugins/addon/ExtractArchive.py
pyload/plugins/addon/HotFolder.py
pyload/plugins/addon/IRCInterface.py
pyload/plugins/addon/MergeFiles.py
pyload/plugins/addon/MultiHome.py
pyload/plugins/addon/RestartFailed.py
pyload/plugins/addon/UnSkipOnFail.py
pyload/plugins/addon/WindowsPhoneToastNotify.py
pyload/plugins/addon/XMPPInterface.py
pyload/plugins/base/Container.py
pyload/plugins/base/Crypter.py
pyload/plugins/base/Hook.py
pyload/plugins/base/OCR.py
pyload/plugins/container/RSDF.py
pyload/plugins/crypter/DuploadOrgFolder.py
pyload/plugins/crypter/EasybytezComFolder.py
pyload/plugins/crypter/FiredriveComFolder.py
pyload/plugins/crypter/HotfileFolderCom.py
pyload/plugins/crypter/LinkSaveIn.py
pyload/plugins/crypter/MultiuploadCom.py
pyload/plugins/crypter/ShareRapidComFolder.py
pyload/plugins/crypter/TusfilesNetFolder.py
pyload/plugins/crypter/UploadableChFolder.py
pyload/plugins/crypter/UploadedToFolder.py
pyload/plugins/hook/Captcha9kw.py
pyload/plugins/hook/MyfastfileCom.py
pyload/plugins/hoster/BillionuploadsCom.py
pyload/plugins/hoster/CramitIn.py
pyload/plugins/hoster/EasybytezCom.py
pyload/plugins/hoster/File4safeCom.py
pyload/plugins/hoster/FileParadoxIn.py
pyload/plugins/hoster/FilefactoryCom.py
pyload/plugins/hoster/FileomCom.py
pyload/plugins/hoster/FilerioCom.py
pyload/plugins/hoster/FileshareInUa.py
pyload/plugins/hoster/FiredriveCom.py
pyload/plugins/hoster/Ftp.py
pyload/plugins/hoster/HugefilesNet.py
pyload/plugins/hoster/HundredEightyUploadCom.py
pyload/plugins/hoster/Keep2shareCC.py
pyload/plugins/hoster/LoadTo.py
pyload/plugins/hoster/LomafileCom.py
pyload/plugins/hoster/MegaNz.py
pyload/plugins/hoster/MegacrypterCom.py
pyload/plugins/hoster/MovReelCom.py
pyload/plugins/hoster/MyvideoDe.py
pyload/plugins/hoster/NosuploadCom.py
pyload/plugins/hoster/NovafileCom.py
pyload/plugins/hoster/PandaPlaNet.py
pyload/plugins/hoster/PremiumTo.py
pyload/plugins/hoster/RarefileNet.py
pyload/plugins/hoster/RyushareCom.py
pyload/plugins/hoster/SecureUploadEu.py
pyload/plugins/hoster/SendmywayCom.py
pyload/plugins/hoster/ShareRapidCom.py
pyload/plugins/hoster/SockshareCom.py
pyload/plugins/hoster/StreamcloudEu.py
pyload/plugins/hoster/TurbobitNet.py
pyload/plugins/hoster/TusfilesNet.py
pyload/plugins/hoster/UptoboxCom.py
pyload/plugins/hoster/VidPlayNet.py
pyload/plugins/hoster/WebshareCz.py
pyload/plugins/internal/DeadCrypter.py
pyload/plugins/internal/DeadHoster.py
pyload/plugins/internal/MultiHoster.py
pyload/plugins/internal/SimpleCrypter.py
pyload/plugins/internal/SimpleHoster.py
pyload/plugins/internal/UpdateManager.py
pyload/plugins/internal/XFSPAccount.py
pyload/plugins/internal/XFSPHoster.py
pyload/utils/__init__.py
pyload/utils/packagetools.py
pyload/webui/app/cnl.py
Diffstat (limited to 'module/plugins')
46 files changed, 2551 insertions, 0 deletions
diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py new file mode 100644 index 000000000..c33219685 --- /dev/null +++ b/module/plugins/accounts/CatShareNet.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +import re + +from time import mktime, strptime + +from module.plugins.Account import Account + + +class CatShareNet(Account): + __name__ = "CatShareNet" + __type__ = "account" + __version__ = "0.01" + + __description__ = """CatShareNet account plugin""" + __license__ = "GPLv3" + __authors__ = [("prOq", None)] + + + PREMIUM_PATTERN = r'class="nav-collapse collapse pull-right">[\s\w<>=-."/:]*\sz.</a></li>\s*<li><a href="/premium">.*\s*<span style="color: red">(.*?)</span>[\s\w<>/]*href="/logout"' + VALID_UNTIL_PATTERN = r'<div class="span6 pull-right">[\s\w<>=-":;]*<span style="font-size:13px;">.*?<strong>(.*?)</strong></span>' + + + def loadAccountInfo(self, user, req): + premium = False + validuntil = -1 + + html = req.load("http://catshare.net/", decode=True) + + try: + m = re.search(self.PREMIUM_PATTERN, html) + if "Premium" in m.group(1): + premium = True + except: + pass + + try: + m = re.search(self.VALID_UNTIL_PATTERN, html) + expiredate = m.group(1) + if "-" not in expiredate: + validuntil = mktime(strptime(expiredate, "%d.%m.%Y")) + except: + pass + + return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} + + + def login(self, user, data, req): + html = req.load("http://catshare.net/login", + post={'user_email': user, + 'user_password': data['password'], + 'remindPassword': 0, + 'user[submit]': "Login"}) + + if not '<a href="/logout">Wyloguj</a>' in html: + self.wrongPassword() diff --git a/module/plugins/accounts/JunocloudMe.py b/module/plugins/accounts/JunocloudMe.py new file mode 100644 index 000000000..b0fc160f3 --- /dev/null +++ b/module/plugins/accounts/JunocloudMe.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class JunocloudMe(XFSAccount): + __name__ = "JunocloudMe" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Junocloud.me account plugin""" + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "junocloud.me" diff --git a/module/plugins/accounts/Keep2shareCc.py b/module/plugins/accounts/Keep2shareCc.py new file mode 100644 index 000000000..de9b9b5d8 --- /dev/null +++ b/module/plugins/accounts/Keep2shareCc.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +import re + +from time import gmtime, mktime, strptime + +from module.plugins.Account import Account + + +class Keep2shareCc(Account): + __name__ = "Keep2shareCc" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Keep2share.cc account plugin""" + __license__ = "GPLv3" + __authors__ = [("aeronaut", "aeronaut@pianoguy.de")] + + + VALID_UNTIL_PATTERN = r'Premium expires: <b>(.+?)</b>' + TRAFFIC_LEFT_PATTERN = r'Available traffic \(today\):<b><a href="/user/statistic.html">(.+?)</a>' + + LOGIN_FAIL_PATTERN = r'Please fix the following input errors' + + + def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = None + premium = None + + html = req.load("http://keep2share.cc/site/profile.html", decode=True) + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) + + except Exception, e: + self.logError(e) + + else: + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = None + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + try: + trafficleft = self.parseTraffic(m.group(1)) + + except Exception, e: + self.logError(e) + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + + + def login(self, user, data, req): + req.cj.setCookie(".keep2share.cc", "lang", "en") + + html = req.load("http://keep2share.cc/login.html", + post={'LoginForm[username]': user, 'LoginForm[password]': data['password']}) + + if re.search(self.LOGIN_FAIL_PATTERN, html): + self.wrongPassword() diff --git a/module/plugins/accounts/LinestorageCom.py b/module/plugins/accounts/LinestorageCom.py new file mode 100644 index 000000000..cf8dd3f3e --- /dev/null +++ b/module/plugins/accounts/LinestorageCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class LinestorageCom(XFSAccount): + __name__ = "LinestorageCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Linestorage.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "linestorage.com" diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py new file mode 100644 index 000000000..41da7ac73 --- /dev/null +++ b/module/plugins/accounts/MegaRapidCz.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +import re + +from time import mktime, strptime +from module.plugins.Account import Account + + +class MegaRapidCz(Account): + __name__ = "MegaRapidCz" + __type__ = "account" + __version__ = "0.34" + + __description__ = """MegaRapid.cz account plugin""" + __license__ = "GPLv3" + __authors__ = [("MikyWoW", "mikywow@seznam.cz"), + ("zoidberg", "zoidberg@mujmail.cz")] + + + login_timeout = 60 + + LIMITDL_PATTERN = ur'<td>Max. počet paralelních stahování: </td><td>(\d+)' + VALID_UNTIL_PATTERN = ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>' + TRAFFIC_LEFT_PATTERN = r'<tr><td>Kredit</td><td>(.*?) GiB' + + + def loadAccountInfo(self, user, req): + html = req.load("http://megarapid.cz/mujucet/", decode=True) + + m = re.search(self.LIMITDL_PATTERN, html) + if m: + data = self.getAccountData(user) + data['options']['limitDL'] = [int(m.group(1))] + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) + return {"premium": True, "trafficleft": -1, "validuntil": validuntil} + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + trafficleft = float(m.group(1)) * (1 << 20) + return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} + + return {"premium": False, "trafficleft": None, "validuntil": None} + + + def login(self, user, data, req): + htm = req.load("http://megarapid.cz/prihlaseni/") + if "Heslo:" in htm: + start = htm.index('id="inp_hash" name="hash" value="') + htm = htm[start + 33:] + hashes = htm[0:32] + htm = req.load("http://megarapid.cz/prihlaseni/", + post={"hash": hashes, + "login": user, + "pass1": data['password'], + "remember": 0, + "sbmt": u"Přihlásit"}) diff --git a/module/plugins/accounts/NowVideoAt.py b/module/plugins/accounts/NowVideoAt.py new file mode 100644 index 000000000..234984b6b --- /dev/null +++ b/module/plugins/accounts/NowVideoAt.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +import re + +from time import gmtime, mktime, strptime + +from module.plugins.Account import Account + + +class NowVideoAt(Account): + __name__ = "NowVideoAt" + __type__ = "account" + __version__ = "0.01" + + __description__ = """NowVideo.at account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<' + + + def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = -1 + premium = None + + html = req.load("http://www.nowvideo.at/premium.php") + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%Y-%b-%d")) + + except Exception, e: + self.logError(e) + + else: + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = -1 + + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + + + def login(self, user, data, req): + html = req.load("http://www.nowvideo.at/login.php", + post={'user': user, 'pass': data['password']}) + + if ">Invalid login details" is html: + self.wrongPassword() diff --git a/module/plugins/accounts/RapidfileshareNet.py b/module/plugins/accounts/RapidfileshareNet.py new file mode 100644 index 000000000..c0dd7eaee --- /dev/null +++ b/module/plugins/accounts/RapidfileshareNet.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class RapidfileshareNet(XFSAccount): + __name__ = "RapidfileshareNet" + __type__ = "account" + __version__ = "0.05" + + __description__ = """Rapidfileshare.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "rapidfileshare.net" + + TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><label for="name">\s*(?P<S>[\d.,]+)\s*(?:(?P<U>[\w^_]+))?' diff --git a/module/plugins/accounts/UploadcCom.py b/module/plugins/accounts/UploadcCom.py new file mode 100644 index 000000000..d1e1a2ead --- /dev/null +++ b/module/plugins/accounts/UploadcCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class UploadcCom(XFSAccount): + __name__ = "UploadcCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Uploadc.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "uploadc.com" diff --git a/module/plugins/accounts/XFileSharingPro.py b/module/plugins/accounts/XFileSharingPro.py new file mode 100644 index 000000000..fb77ab23f --- /dev/null +++ b/module/plugins/accounts/XFileSharingPro.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class XFileSharingPro(XFSAccount): + __name__ = "XFileSharingPro" + __type__ = "account" + __version__ = "0.05" + + __description__ = """XFileSharingPro multi-purpose account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = None + + + def init(self): + if self.HOSTER_DOMAIN: + return super(XFileSharingPro, self).init() + + + def loadAccountInfo(self, user, req): + return super(XFileSharingPro if self.HOSTER_DOMAIN else XFSAccount, self).loadAccountInfo(user, req) + + + def login(self, user, data, req): + if self.HOSTER_DOMAIN: + return super(XFileSharingPro, self).login(user, data, req) diff --git a/module/plugins/crypter/FilesonicComFolder.py b/module/plugins/crypter/FilesonicComFolder.py new file mode 100644 index 000000000..2d0540d26 --- /dev/null +++ b/module/plugins/crypter/FilesonicComFolder.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadCrypter import DeadCrypter + + +class FilesonicComFolder(DeadCrypter): + __name__ = "FilesonicComFolder" + __type__ = "crypter" + __version__ = "0.12" + + __pattern__ = r'http://(?:www\.)?filesonic\.com/folder/\w+' + + __description__ = """Filesonic.com folder decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/crypter/HotfileComFolder.py b/module/plugins/crypter/HotfileComFolder.py new file mode 100644 index 000000000..3fc8f6f63 --- /dev/null +++ b/module/plugins/crypter/HotfileComFolder.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadCrypter import DeadCrypter + + +class HotfileComFolder(DeadCrypter): + __name__ = "HotfileComFolder" + __type__ = "crypter" + __version__ = "0.3" + + __pattern__ = r'https?://(?:www\.)?hotfile\.com/list/\w+/\w+' + __config__ = [] + + __description__ = """Hotfile.com folder decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] diff --git a/module/plugins/crypter/JunocloudMeFolder.py b/module/plugins/crypter/JunocloudMeFolder.py new file mode 100644 index 000000000..509f1f7ec --- /dev/null +++ b/module/plugins/crypter/JunocloudMeFolder.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSCrypter import XFSCrypter + + +class JunocloudMeFolder(XFSCrypter): + __name__ = "JunocloudMeFolder" + __type__ = "crypter" + __version__ = "0.03" + + __pattern__ = r'http://(?:www\.)?junocloud\.me/folders/(?P<ID>\d+/\w+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """Junocloud.me folder decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "junocloud.me" diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py new file mode 100644 index 000000000..67b1a3f02 --- /dev/null +++ b/module/plugins/crypter/LinkCryptWs.py @@ -0,0 +1,343 @@ +# -*- coding: utf-8 -*- + +import base64 +import binascii +import re + +import pycurl + +from Crypto.Cipher import AES + +from module.plugins.Crypter import Crypter +from module.utils import html_unescape + + +class LinkCryptWs(Crypter): + __name__ = "LinkCryptWs" + __type__ = "crypter" + __version__ = "0.04" + + __pattern__ = r'http://(?:www\.)?linkcrypt\.ws/(dir|container)/(?P<ID>\w+)' + + __description__ = """LinkCrypt.ws decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("kagenoshin", "kagenoshin[AT]gmx[DOT]ch"), + ("glukgluk", None)] + + + JK_KEY = "jk" + CRYPTED_KEY = "crypted" + + + def setup(self): + self.html = None + self.fileid = None + self.captcha = False + self.package = None + + self.preferred_sources = ['cnl', 'web', 'dlc', 'rsdf', 'ccf', ] #['cnl', 'rsdf', 'ccf', 'dlc', 'web'] + + + def prepare(): + # Init + self.package = pyfile.package() + self.fileid = re.match(self.__pattern__, pyfile.url).group('ID') + + self.req.cj.setCookie(".linkcrypt.ws", "language", "en") + + # Request package + self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") #better chance to not get those key-captchas + self.html = self.load(self.pyfile.url) + + + def decrypt(self, pyfile): + #check if we have js + if not self.js: + self.fail(_("Missing JS Engine")) + + package_found = None + + self.prepare() + + if not self.isOnline(): + self.offline() + + if self.isKeyCaptchaProtected(): + self.retry(4, 30, _("Can't handle Key-Captcha")) + + if self.isCaptchaProtected(): + self.captcha = True + self.unlockCaptchaProtection() + self.handleCaptchaErrors() + + # Check for protection + if self.isPasswordProtected(): + self.unlockPasswordProtection() + self.handleErrors() + + # get unrar password + self.getunrarpw() + + # Get package name and folder + package_name, folder_name = self.getPackageInfo() + + #get the container definitions from script section + self.get_container_html() + + # Extract package links + package_links = [] + + for type_ in self.preferred_sources: + links = self.handleLinkSource(type_) + if links: + if isinstance(links, list): + package_links.extend(links) + else: + package_found = True + break + + package_links = set(package_links) + + # Pack + if package_links: + self.packages = [(package_name, package_links, folder_name)] + + elif package_found: + self.core.api.deletePackages([self.package.id]) + + + def isOnline(self): + if "<title>Linkcrypt.ws // Error 404</title>" in self.html: + self.logDebug("folder doesen't exist anymore") + return False + else: + return True + + + def isPasswordProtected(self): + if "Authorizing" in self.html: + self.logDebug("Links are password protected") + return True + else: + return False + + + def isCaptchaProtected(self): + if 'id="captcha">' in self.html: + self.logDebug("Links are captcha protected") + return True + else: + return False + + + def isKeyCaptchaProtected(self): + if re.search(r'Key[ -]', self.html, re.I): + return True + else: + return False + + + def unlockPasswordProtection(self): + password = self.getPassword() + + if password: + self.logDebug("Submitting password [%s] for protected links" % password) + self.html = self.load(self.pyfile.url, post={"password": password, 'x': "0", 'y': "0"}) + else: + self.fail(_("Folder is password protected")) + + + def unlockCaptchaProtection(self): + captcha_url = re.search(r'<form.*?id\s*?=\s*?"captcha"[^>]*?>.*?<\s*?input.*?src="([^"]*?)"', self.html, re.I | re.S).group(1) + captcha_code = self.decryptCaptcha(captcha_url, forceUser=True, imgtype="gif", result_type='positional') + + self.html = self.load(self.pyfile.url, post={"x": captcha_code[0], "y": captcha_code[1]}) + + + def getPackageInfo(self): + name = self.pyfile.package().name + folder = self.pyfile.package().folder + + self.logDebug("Defaulting to pyfile name [%s] and folder [%s] for package" % (name, folder)) + + return name, folder + + + def getunrarpw(self): + sitein = self.html + indexi = sitein.find("|source|") + 8 + indexe = sitein.find("|",indexi) + + unrarpw = sitein[indexi:indexe] + + if not (unrarpw == "Password" or "Dateipasswort") : + self.logDebug("File password set to: [%s]"% unrarpw) + self.pyfile.package().password = unrarpw + + + def handleErrors(self): + if self.isPasswordProtected(): + self.fail(_("Incorrect password")) + + + def handleCaptchaErrors(self): + if self.captcha: + if "Your choice was wrong!" in self.html: + self.invalidCaptcha() + self.retry() + else: + self.correctCaptcha() + + + def handleLinkSource(self, type_): + if type_ is 'cnl': + return self.handleCNL2() + + elif type_ is 'web': + return self.handleWebLinks() + + elif type_ in ('rsdf', 'ccf', 'dlc'): + return self.handleContainer(type_) + + else: + self.error(_("Unknown source type: %s") % type_) + + + def handleWebLinks(self): + self.logDebug("Search for Web links ") + + package_links = [] + pattern = r'<form action="http://linkcrypt.ws/out.html"[^>]*?>.*?<input[^>]*?value="([^"]*?)"[^>]*?name="file"' + ids = re.findall(pattern, self.html, re.I | re.S) + + self.logDebug("Decrypting %d Web links" % len(ids)) + + for idx, weblink_id in enumerate(ids): + try: + self.logDebug("Decrypting Web link %d, %s" % (idx + 1, weblink_id)) + + res = self.load("http://linkcrypt.ws/out.html", post = {'file':weblink_id}) + + indexs = res.find("window.location =") + 19 + indexe = res.find('"', indexs) + + link2 = res[indexs:indexe] + + self.logDebug(link2) + + link2 = html_unescape(link2) + package_links.append(link2) + + except Exception, detail: + self.logDebug("Error decrypting Web link %s, %s" % (weblink_id, detail)) + + return package_links + + + def get_container_html(self): + self.container_html = [] + + script = re.search(r'<div.*?id="ad_cont".*?<script.*?javascrip[^>]*?>(.*?)</script', self.html, re.I | re.S) + + if script: + container_html_text = script.group(1) + container_html_text.strip() + self.container_html = container_html_text.splitlines() + + + def handle_javascript(self, line): + return self.js.eval(line.replace('{}))',"{}).replace('document.open();document.write','').replace(';document.close();',''))")) + + + def handleContainer(self, type_): + package_links = [] + type_ = type_.lower() + + self.logDebug('Search for %s Container links' % type_.upper()) + + if not type_.isalnum(): # check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric) + self.error(_("unknown container type: %s") % type_) + + for line in self.container_html: + if(type_ in line): + jseval = self.handle_javascript(line) + clink = re.search(r'href=["\']([^"\']*?)["\']',jseval,re.I) + + if not clink: + continue + + self.logDebug("clink avaible") + + package_name, folder_name = self.getPackageInfo() + self.logDebug("Added package with name %s.%s and container link %s" %( package_name, type_, clink.group(1))) + self.core.api.uploadContainer( "%s.%s" %(package_name, type_), self.load(clink.group(1))) + return "Found it" + + return package_links + + + def handleCNL2(self): + self.logDebug("Search for CNL links") + + package_links = [] + cnl_line = None + + for line in self.container_html: + if("cnl" in line): + cnl_line = line + break + + if cnl_line: + self.logDebug("cnl_line gefunden") + + try: + cnl_section = self.handle_javascript(cnl_line) + (vcrypted, vjk) = self._getCipherParams(cnl_section) + for (crypted, jk) in zip(vcrypted, vjk): + package_links.extend(self._getLinks(crypted, jk)) + except: + self.logError(_("Unable to decrypt CNL links (JS Error) try to get over links")) + return self.handleWebLinks() + + return package_links + + + def _getCipherParams(self, cnl_section): + # Get jk + jk_re = r'<INPUT.*?NAME="%s".*?VALUE="(.*?)"' % LinkCryptWs.JK_KEY + vjk = re.findall(jk_re, cnl_section) + + # Get crypted + crypted_re = r'<INPUT.*?NAME="%s".*?VALUE="(.*?)"' % LinkCryptWs.CRYPTED_KEY + vcrypted = re.findall(crypted_re, cnl_section) + + # Log and return + self.logDebug("Detected %d crypted blocks" % len(vcrypted)) + return vcrypted, vjk + + + def _getLinks(self, crypted, jk): + # Get key + jreturn = self.js.eval("%s f()" % jk) + key = binascii.unhexlify(jreturn) + + self.logDebug("JsEngine returns value [%s]" % jreturn) + + # Decode crypted + crypted = base64.standard_b64decode(crypted) + + # Decrypt + Key = key + IV = key + obj = AES.new(Key, AES.MODE_CBC, IV) + text = obj.decrypt(crypted) + + # Extract links + text = text.replace("\x00", "").replace("\r", "") + links = text.split("\n") + links = filter(lambda x: x != "", links) + + # Log and return + self.logDebug("Package has %d links" % len(links)) + + return links diff --git a/module/plugins/crypter/MegaRapidCzFolder.py b/module/plugins/crypter/MegaRapidCzFolder.py new file mode 100644 index 000000000..d9fb828a8 --- /dev/null +++ b/module/plugins/crypter/MegaRapidCzFolder.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class MegaRapidCzFolder(SimpleCrypter): + __name__ = "MegaRapidCzFolder" + __type__ = "crypter" + __version__ = "0.02" + + __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/slozka/\d+/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """Share-Rapid.com folder decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + + LINK_PATTERN = r'<td class="soubor"[^>]*><a href="([^"]+)">' diff --git a/module/plugins/crypter/MegauploadComFolder.py b/module/plugins/crypter/MegauploadComFolder.py new file mode 100644 index 000000000..1d487ed61 --- /dev/null +++ b/module/plugins/crypter/MegauploadComFolder.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadCrypter import DeadCrypter + + +class MegauploadComFolder(DeadCrypter): + __name__ = "MegauploadComFolder" + __type__ = "crypter" + __version__ = "0.02" + + __pattern__ = r'http://(?:www\.)?megaupload\.com/(\?f|xml/folderfiles\.php\?.*&?folderid)=\w+' + + __description__ = """Megaupload.com folder decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/crypter/RapidfileshareNetFolder.py b/module/plugins/crypter/RapidfileshareNetFolder.py new file mode 100644 index 000000000..5531d5a90 --- /dev/null +++ b/module/plugins/crypter/RapidfileshareNetFolder.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSCrypter import XFSCrypter + + +class RapidfileshareNetFolder(XFSCrypter): + __name__ = "RapidfileshareNetFolder" + __type__ = "crypter" + __version__ = "0.03" + + __pattern__ = r'http://(?:www\.)?rapidfileshare\.net/users/\w+/\d+/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """Rapidfileshare.net folder decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "rapidfileshare.net" diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py new file mode 100644 index 000000000..3c952fd6b --- /dev/null +++ b/module/plugins/crypter/SexuriaCom.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter + + +class SexuriaCom(Crypter): + __name__ = "SexuriaCom" + __type__ = "crypter" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_.+?_(\d+)\.html|dl_links_\d+_\d+\.html|id=\d+\&part=\d+\&link=\d+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """Sexuria.com decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("NETHead", "NETHead.AT.gmx.DOT.net")] + + + PATTERN_SUPPORTED_MAIN = re.compile(r'http://(www\.)?sexuria\.com/(v1/)?Pornos_Kostenlos_.+?_(\d+)\.html', flags=re.I) + PATTERN_SUPPORTED_CRYPT = re.compile(r'http://(www\.)?sexuria\.com/(v1/)?dl_links_\d+_(?P<ID>\d+)\.html', flags=re.I) + PATTERN_SUPPORTED_REDIRECT = re.compile(r'http://(www\.)?sexuria\.com/out\.php\?id=(?P<ID>\d+)\&part=\d+\&link=\d+', flags=re.I) + PATTERN_TITLE = re.compile(r'<title> - (?P<TITLE>.*) Sexuria - Kostenlose Pornos - Rapidshare XXX Porn</title>', flags=re.I) + PATTERN_PASSWORD = re.compile(r'<strong>Passwort: </strong></div></td>.*?bgcolor="#EFEFEF">(?P<PWD>.*?)</td>', flags=re.I | re.S) + PATTERN_DL_LINK_PAGE = re.compile(r'"(dl_links_\d+_\d+\.html)"', flags=re.I) + PATTERN_REDIRECT_LINKS = re.compile(r'value="(http://sexuria\.com/out\.php\?id=\d+\&part=\d+\&link=\d+)" readonly', flags=re.I) + + + def decrypt(self, pyfile): + # Init + self.pyfile = pyfile + self.package = pyfile.package() + + # Get package links + package_name, self.links, folder_name, package_pwd = self.decryptLinks(self.pyfile.url) + self.packages = [(package_name, self.links, folder_name)] + + + def decryptLinks(self, url): + linklist = [] + name = self.package.name + folder = self.package.folder + password = None + + if re.match(self.PATTERN_SUPPORTED_MAIN, url): + # Processing main page + html = self.load(url) + links = re.findall(self.PATTERN_DL_LINK_PAGE, html) + for link in links: + linklist.append("http://sexuria.com/v1/" + link) + + elif re.match(self.PATTERN_SUPPORTED_REDIRECT, url): + # Processing direct redirect link (out.php), redirecting to main page + id = re.search(self.PATTERN_SUPPORTED_REDIRECT, url).group('ID') + if id: + linklist.append("http://sexuria.com/v1/Pornos_Kostenlos_liebe_%s.html" % id) + + elif re.match(self.PATTERN_SUPPORTED_CRYPT, url): + # Extract info from main file + id = re.search(self.PATTERN_SUPPORTED_CRYPT, url).group('ID') + html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id, decode=True) + + title = re.search(self.PATTERN_TITLE, html).group('TITLE').strip() + if title: + name = folder = title + self.logDebug("Package info found, name [%s] and folder [%s]" % (name, folder)) + + pwd = re.search(self.PATTERN_PASSWORD, html).group('PWD') + if pwd: + password = pwd.strip() + self.logDebug("Password info [%s] found" % password) + + # Process link (dl_link) + html = self.load(url) + links = re.findall(self.PATTERN_REDIRECT_LINKS, html) + if len(links) == 0: + self.LogError("Broken for link %s" % link) + else: + for link in links: + link = link.replace("http://sexuria.com/", "http://www.sexuria.com/") + finallink = self.load(link, just_header=True)['location'] + if not finallink or "sexuria.com/" in finallink: + self.LogError("Broken for link %s" % link) + else: + linklist.append(finallink) + + # Debug log + self.logDebug("%d supported links" % len(linklist)) + for i, link in enumerate(linklist): + self.logDebug("Supported link %d, %s" % (i + 1, link)) + + return name, linklist, folder, password diff --git a/module/plugins/crypter/SharingmatrixComFolder.py b/module/plugins/crypter/SharingmatrixComFolder.py new file mode 100644 index 000000000..ddc3bdb37 --- /dev/null +++ b/module/plugins/crypter/SharingmatrixComFolder.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadCrypter import DeadCrypter + + +class SharingmatrixComFolder(DeadCrypter): + __name__ = "SharingmatrixComFolder" + __type__ = "crypter" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?sharingmatrix\.com/folder/\w+' + + __description__ = """Sharingmatrix.com folder decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/crypter/WuploadComFolder.py b/module/plugins/crypter/WuploadComFolder.py new file mode 100644 index 000000000..b77bc3e67 --- /dev/null +++ b/module/plugins/crypter/WuploadComFolder.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadCrypter import DeadCrypter + + +class WuploadComFolder(DeadCrypter): + __name__ = "WuploadComFolder" + __type__ = "crypter" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?wupload\.com/folder/\w+' + + __description__ = """Wupload.com folder decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py new file mode 100644 index 000000000..dffd8909c --- /dev/null +++ b/module/plugins/crypter/XFileSharingProFolder.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.XFSCrypter import XFSCrypter + + +class XFileSharingProFolder(XFSCrypter): + __name__ = "XFileSharingProFolder" + __type__ = "crypter" + __version__ = "0.03" + + __pattern__ = r'^unmatchable$' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """XFileSharingPro dummy folder decrypter plugin for hook""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + def _log(self, type, args): + msg = " | ".join([str(a).strip() for a in args if a]) + logger = getattr(self.log, type) + logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper()))) + + + def init(self): + super(XFileSharingProFolder, self).init() + + self.__pattern__ = self.core.pluginManager.crypterPlugins[self.__name__]['pattern'] + + self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group(1).lower() + self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) + + account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) + + if account and account.canUse(): + self.account = account + elif self.account: + self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + else: + return + + self.user, data = self.account.selectAccount() + self.req = self.account.getAccountRequest(self.user) + self.premium = self.account.isPremium(self.user) diff --git a/module/plugins/hoster/EnteruploadCom.py b/module/plugins/hoster/EnteruploadCom.py new file mode 100644 index 000000000..bbd613f57 --- /dev/null +++ b/module/plugins/hoster/EnteruploadCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class EnteruploadCom(DeadHoster): + __name__ = "EnteruploadCom" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'http://(?:www\.)?enterupload\.com/\w+' + + __description__ = """EnterUpload.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + +getInfo = create_getInfo(EnteruploadCom) diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py new file mode 100644 index 000000000..5a9cbb456 --- /dev/null +++ b/module/plugins/hoster/FileSharkPl.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +import re + +from urlparse import urljoin + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class FileSharkPl(SimpleHoster): + __name__ = "FileSharkPl" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d{6}/\w{5}' + + __description__ = """FileShark.pl hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("prOq", None), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'<h2 class="name-file">(?P<N>.+)</h2>' + SIZE_PATTERN = r'<p class="size-file">(.*?)<strong>(?P<S>\d+\.?\d*)\s(?P<U>\w+)</strong></p>' + + OFFLINE_PATTERN = '(P|p)lik zosta. (usuni.ty|przeniesiony)' + + DOWNLOAD_ALERT = r'<p class="lead text-center alert alert-warning">(.*?)</p>' + IP_BLOCKED_PATTERN = 'Strona jest dost.pna wy..cznie dla u.ytkownik.w znajduj.cych si. na terenie Polski' + DOWNLOAD_SLOTS_ERROR_PATTERN = r'Osi.gni.to maksymaln. liczb. .ci.ganych jednocze.nie plik.w\.' + + DOWNLOAD_URL_FREE = r'<a href="(.*?)" class="btn-upload-free">' + DOWNLOAD_URL_PREMIUM = r'<a href="(.*?)" class="btn-upload-premium">' + + SECONDS_PATTERN = r'var timeToDownload = (\d+);' + + CAPTCHA_IMG_PATTERN = '<img src="data:image/jpeg;base64,(.*?)" title="captcha"' + CAPTCHA_TOKEN_PATTERN = r'name="form\[_token\]" value="(.*?)" />' + + + def setup(self): + self.resumeDownload = True + if self.premium: + self.multiDL = True + self.limitDL = 20 + else: + self.multiDL = False + + + def prepare(self): + super(FileSharkPl, self).prepare() + + m = re.search(self.DOWNLOAD_ALERT, self.html): + if m: + return + + alert = m.group(1) + + if re.match(self.IP_BLOCKED_PATTERN, alert): + self.fail(_("Only connections from Polish IP are allowed")) + elif re.match(self.DOWNLOAD_SLOTS_ERROR_PATTERN, alert): + self.logInfo(_("No free download slots available")) + self.retry(10, 30 * 60, _("Still no free download slots available")) + else: + self.logInfo(alert) + self.retry(10, 10 * 60, _("Try again later")) + + + #@NOTE: handlePremium method was never been tested + def handlePremium(self): + self.logDebug("Premium accounts support in experimental modus!") + m = re.search(self.DOWNLOAD_URL_PREMIUM, self.html) + file_url = urljoin("http://fileshark.pl", m.group(1)) + + self.download(file_url, disposition=True) + self.checkDownload() + + + def handleFree(self): + m = re.search(self.DOWNLOAD_URL_FREE, self.html) + if m is None: + self.error(_("Download url not found")) + + file_url = urljoin("http://fileshark.pl", m.group(1)) + + m = re.search(self.SECONDS_PATTERN, self.html) + if m: + seconds = int(m.group(1)) + self.logDebug("Wait %s seconds" % seconds) + self.wait(seconds + 2) + + action, inputs = self.parseHtmlForm('action=""') + m = re.search(self.CAPTCHA_TOKEN_PATTERN, self.html) + if m is None: + self.retry(reason=_("Captcha form not found")) + + inputs['form[_token]'] = m.group(1) + + m = re.search(self.CAPTCHA_IMG_PATTERN, self.html) + if m is None: + self.retry(reason=_("Captcha image not found")) + + tmp_load = self.load + self.load = self.decode64 #: injects decode64 inside decryptCaptcha + + inputs['form[captcha]'] = self.decryptCaptcha(m.group(1), imgtype='jpeg') + inputs['form[start]'] = "" + + self.load = tmp_load + + self.download(file_url, post=inputs, cookies=True, disposition=True) + self.checkDownload() + + + def checkDownload(self): + check = super(FileSharkPl, self).checkDownload({ + 'wrong_captcha': re.compile(r'<label for="form_captcha" generated="true" class="error">(.*?)</label>'), + 'wait_pattern': re.compile(self.SECONDS_PATTERN), + 'DL-found': re.compile('<a href="(.*)">') + }) + + if check == "DL-found": + self.correctCaptcha() + + elif check == "wrong_captcha": + self.invalidCaptcha() + self.retry(10, 1, _("Wrong captcha solution")) + + elif check == "wait_pattern": + self.retry() + + + def decode64(self, data, *args, **kwargs): + return data.decode("base64") + + +getInfo = create_getInfo(FileSharkPl) diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py new file mode 100644 index 000000000..8bfa0fa2e --- /dev/null +++ b/module/plugins/hoster/FilesonicCom.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class FilesonicCom(DeadHoster): + __name__ = "FilesonicCom" + __type__ = "hoster" + __version__ = "0.35" + + __pattern__ = r'http://(?:www\.)?filesonic\.com/file/\w+' + + __description__ = """Filesonic.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("paulking", None)] + + +getInfo = create_getInfo(FilesonicCom) diff --git a/module/plugins/hoster/JunocloudMe.py b/module/plugins/hoster/JunocloudMe.py new file mode 100644 index 000000000..0f839960a --- /dev/null +++ b/module/plugins/hoster/JunocloudMe.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo + + +class JunocloudMe(XFSHoster): + __name__ = "JunocloudMe" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'http://(?:\w+\.)?junocloud\.me/\w{12}' + + __description__ = """Junocloud.me hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "junocloud.me" + + URL_REPLACEMENTS = [(r'/(?:embed-)?(\w{12}).*', r'/\1'), (r'//www\.', "//dl3.")] + + NAME_PATTERN = r'<p class="request_file">http://junocloud.me/w{12}/(?P<N>.+?)</p>' + SIZE_PATTERN = r'<p class="request_filesize">Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)</p>' + + OFFLINE_PATTERN = r'>No such file with this filename<' + TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' + + +getInfo = create_getInfo(JunocloudMe) diff --git a/module/plugins/hoster/Keep2shareCc.py b/module/plugins/hoster/Keep2shareCc.py new file mode 100644 index 000000000..fd8a5524d --- /dev/null +++ b/module/plugins/hoster/Keep2shareCc.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- + +import re + +from urlparse import urlparse, urljoin + +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class Keep2shareCc(SimpleHoster): + __name__ = "Keep2shareCc" + __type__ = "hoster" + __version__ = "0.15" + + __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' + + __description__ = """Keep2share.cc hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'File: <span>(?P<N>.+)</span>' + SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' + OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' + + LINK_PATTERN = r'To download this file with slow speed, use <a href="([^"]+)">this link</a>' + CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' + WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' + MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time' + + + def handleFree(self): + self.sanitize_url() + self.html = self.load(self.pyfile.url) + + self.fid = re.search(r'<input type="hidden" name="slow_id" value="([^"]+)">', self.html).group(1) + self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': self.fid}) + + if ">Downloading is not possible" in self.html: + self.fail("Free user can't download large files") + + m = re.search(r"function download\(\){.*window\.location\.href = '([^']+)';", self.html, re.S) + if m: # Direct mode + self.startDownload(m.group(1)) + else: + self.handleCaptcha() + + self.wait(30) + + self.html = self.load(self.pyfile.url, post={'uniqueId': self.fid, 'free': 1}) + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.logDebug("Hoster told us to wait for %s" % m.group(1)) + # string to time convert courtesy of https://stackoverflow.com/questions/10663720 + ftr = [3600, 60, 1] + wait_time = sum([a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))]) + self.wait(wait_time, True) + self.retry() + + m = re.search(self.MULTIDL_ERROR, self.html) + if m: + # if someone is already downloading on our line, wait 30min and retry + self.logDebug("Already downloading, waiting for 30 minutes") + self.wait(30 * 60, True) + self.retry() + + m = re.search(self.LINK_PATTERN, self.html) + if m is None: + self.error(_("LINK_PATTERN not found")) + self.startDownload(m.group(1)) + + + def handleCaptcha(self): + recaptcha = ReCaptcha(self) + + for _i in xrange(5): + post_data = {'free': 1, + 'freeDownloadRequest': 1, + 'uniqueId': self.fid, + 'yt0': ''} + + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: + captcha_url = urljoin(self.base_url, m.group(1)) + post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) + else: + challenge, response = recaptcha.challenge() + post_data.update({'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response}) + + self.html = self.load(self.pyfile.url, post=post_data) + + if 'recaptcha' not in self.html: + self.correctCaptcha() + break + else: + self.invalidCaptcha() + else: + self.fail(_("All captcha attempts failed")) + + + def startDownload(self, url): + d = urljoin(self.base_url, url) + self.download(d, disposition=True) + + + def sanitize_url(self): + header = self.load(self.pyfile.url, just_header=True) + if 'location' in header: + self.pyfile.url = header['location'] + p = urlparse(self.pyfile.url) + self.base_url = "%s://%s" % (p.scheme, p.hostname) + + +getInfo = create_getInfo(Keep2shareCc) diff --git a/module/plugins/hoster/KickloadCom.py b/module/plugins/hoster/KickloadCom.py new file mode 100644 index 000000000..1c39db46c --- /dev/null +++ b/module/plugins/hoster/KickloadCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class KickloadCom(DeadHoster): + __name__ = "KickloadCom" + __type__ = "hoster" + __version__ = "0.21" + + __pattern__ = r'http://(?:www\.)?kickload\.com/get/.+' + + __description__ = """Kickload.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] + + +getInfo = create_getInfo(KickloadCom) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py new file mode 100644 index 000000000..2129fbfc8 --- /dev/null +++ b/module/plugins/hoster/MegaCoNz.py @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- + +import random +import re + +from array import array +from base64 import standard_b64decode +from os import remove + +from Crypto.Cipher import AES +from Crypto.Util import Counter +from pycurl import SSL_CIPHER_LIST + +from module.common.json_layer import json_loads, json_dumps +from module.plugins.Hoster import Hoster + + +class MegaCoNz(Hoster): + __name__ = "MegaCoNz" + __type__ = "hoster" + __version__ = "0.16" + + __pattern__ = r'https?://(\w+\.)?mega\.co\.nz/#!([\w!-]+)' + + __description__ = """Mega.co.nz hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "ranan@pyload.org")] + + + API_URL = "https://g.api.mega.co.nz/cs?id=%d" + FILE_SUFFIX = ".crypted" + + + def b64_decode(self, data): + data = data.replace("-", "+").replace("_", "/") + return standard_b64decode(data + '=' * (-len(data) % 4)) + + + def getCipherKey(self, key): + """ Construct the cipher key from the given data """ + a = array("I", key) + key_array = array("I", [a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]]) + return key_array + + + def callApi(self, **kwargs): + """ Dispatch a call to the api, see https://mega.co.nz/#developers """ + # generate a session id, no idea where to obtain elsewhere + uid = random.randint(10 << 9, 10 ** 10) + + res = self.load(self.API_URL % uid, post=json_dumps([kwargs])) + self.logDebug("Api Response: " + res) + return json_loads(res) + + + def decryptAttr(self, data, key): + cbc = AES.new(self.getCipherKey(key), AES.MODE_CBC, "\0" * 16) + attr = cbc.decrypt(self.b64_decode(data)) + self.logDebug("Decrypted Attr: " + attr) + if not attr.startswith("MEGA"): + self.fail(_("Decryption failed")) + + # Data is padded, 0-bytes must be stripped + return json_loads(re.search(r'{.+?}', attr).group(0)) + + + def decryptFile(self, key): + """ Decrypts the file at lastDownload` """ + + # upper 64 bit of counter start + n = key[16:24] + + # convert counter to long and shift bytes + ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) + cipher = AES.new(self.getCipherKey(key), AES.MODE_CTR, counter=ctr) + + self.pyfile.setStatus("decrypting") + + file_crypted = self.lastDownload + file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0] + + try: + f = open(file_crypted, "rb") + df = open(file_decrypted, "wb") + except IOError, e: + self.fail(str(e)) + + # TODO: calculate CBC-MAC for checksum + + size = 2 ** 15 # buffer size, 32k + while True: + buf = f.read(size) + if not buf: + break + + df.write(cipher.decrypt(buf)) + + f.close() + df.close() + remove(file_crypted) + + self.lastDownload = file_decrypted + + + def process(self, pyfile): + key = None + + # match is guaranteed because plugin was chosen to handle url + node = re.match(self.__pattern__, pyfile.url).group(2) + if "!" in node: + node, key = node.split("!") + + self.logDebug("File id: %s | Key: %s" % (node, key)) + + if not key: + self.fail(_("No file key provided in the URL")) + + # g is for requesting a download url + # this is similar to the calls in the mega js app, documentation is very bad + dl = self.callApi(a="g", g=1, p=node, ssl=1)[0] + + if "e" in dl: + e = dl['e'] + # ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later + if e == -18: + self.retry() + else: + self.fail(_("Error code:") + e) + + # TODO: map other error codes, e.g + # EACCESS (-11): Access violation (e.g., trying to write to a read-only share) + + key = self.b64_decode(key) + attr = self.decryptAttr(dl['at'], key) + + pyfile.name = attr['n'] + self.FILE_SUFFIX + + self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") + + self.download(dl['g']) + self.decryptFile(key) + + # Everything is finished and final name can be set + pyfile.name = attr['n'] diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py new file mode 100644 index 000000000..b3100b6d4 --- /dev/null +++ b/module/plugins/hoster/MegaRapidCz.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +import re + +from pycurl import HTTPHEADER + +from module.network.RequestFactory import getRequest +from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo + + +def getInfo(urls): + h = getRequest() + h.c.setopt(HTTPHEADER, + ["Accept: text/html", + "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"]) + + for url in urls: + html = h.load(url, decode=True) + yield parseFileInfo(MegaRapidCz, url, html) + + +class MegaRapidCz(SimpleHoster): + __name__ = "MegaRapidCz" + __type__ = "hoster" + __version__ = "0.54" + + __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' + + __description__ = """MegaRapid.cz hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("MikyWoW", "mikywow@seznam.cz"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'<h1[^>]*><span[^>]*>(?:<a[^>]*>)?(?P<N>[^<]+)' + SIZE_PATTERN = r'<td class="i">Velikost:</td>\s*<td class="h"><strong>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong></td>' + OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' + + FORCE_CHECK_TRAFFIC = True + + LINK_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>' + ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům' + ERR_CREDIT_PATTERN = ur'<div class="error_div"><strong>Stahování zdarma je možné jen přes náš' + + + def setup(self): + self.chunkLimit = 1 + + + def handlePremium(self): + try: + self.html = self.load(self.pyfile.url, decode=True) + except BadHeader, e: + self.account.relogin(self.user) + self.retry(wait_time=60, reason=str(e)) + + m = re.search(self.LINK_PATTERN, self.html) + if m: + link = m.group(1) + self.logDebug("Premium link: %s" % link) + self.download(link, disposition=True) + else: + if re.search(self.ERR_LOGIN_PATTERN, self.html): + self.relogin(self.user) + self.retry(wait_time=60, reason=_("User login failed")) + elif re.search(self.ERR_CREDIT_PATTERN, self.html): + self.fail(_("Not enough credit left")) + else: + self.fail(_("Download link not found")) diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py new file mode 100644 index 000000000..7f51a8a46 --- /dev/null +++ b/module/plugins/hoster/MegauploadCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class MegauploadCom(DeadHoster): + __name__ = "MegauploadCom" + __type__ = "hoster" + __version__ = "0.31" + + __pattern__ = r'http://(?:www\.)?megaupload\.com/\?.*&?(d|v)=\w+' + + __description__ = """Megaupload.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org")] + + +getInfo = create_getInfo(MegauploadCom) diff --git a/module/plugins/hoster/MegavideoCom.py b/module/plugins/hoster/MegavideoCom.py new file mode 100644 index 000000000..24905ce62 --- /dev/null +++ b/module/plugins/hoster/MegavideoCom.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class MegavideoCom(DeadHoster): + __name__ = "MegavideoCom" + __type__ = "hoster" + __version__ = "0.21" + + __pattern__ = r'http://(?:www\.)?megavideo\.com/\?.*&?(d|v)=\w+' + + __description__ = """Megavideo.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("mkaay", "mkaay@mkaay.de")] + + +getInfo = create_getInfo(MegavideoCom) diff --git a/module/plugins/hoster/NahrajCz.py b/module/plugins/hoster/NahrajCz.py new file mode 100644 index 000000000..6b5699408 --- /dev/null +++ b/module/plugins/hoster/NahrajCz.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class NahrajCz(DeadHoster): + __name__ = "NahrajCz" + __type__ = "hoster" + __version__ = "0.21" + + __pattern__ = r'http://(?:www\.)?nahraj\.cz/content/download/.+' + + __description__ = """Nahraj.cz hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + +getInfo = create_getInfo(NahrajCz) diff --git a/module/plugins/hoster/NowVideoAt.py b/module/plugins/hoster/NowVideoAt.py new file mode 100644 index 000000000..53d782d06 --- /dev/null +++ b/module/plugins/hoster/NowVideoAt.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class NowVideoAt(SimpleHoster): + __name__ = "NowVideoAt" + __type__ = "hoster" + __version__ = "0.05" + + __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|sx)/(video|mobile/#/videos)/(?P<ID>\w+)' + + __description__ = """NowVideo.at hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + URL_REPLACEMENTS = [(__pattern__, r'http://www.nowvideo.at/video/\g<ID>')] + + NAME_PATTERN = r'<h4>(?P<N>.+?)<' + OFFLINE_PATTERN = r'>This file no longer exists' + + LINK_FREE_PATTERN = r'<source src="(.+?)"' + LINK_PREMIUM_PATTERN = r'<div id="content_player" >\s*<a href="(.+?)"' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + + + def handleFree(self): + self.html = self.load("http://www.nowvideo.at/mobile/video.php", get={'id': self.info['ID']}) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Free download link not found")) + + self.download(m.group(1)) + + +getInfo = create_getInfo(NowVideoAt) diff --git a/module/plugins/hoster/OronCom.py b/module/plugins/hoster/OronCom.py new file mode 100644 index 000000000..7e8423ec9 --- /dev/null +++ b/module/plugins/hoster/OronCom.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class OronCom(DeadHoster): + __name__ = "OronCom" + __type__ = "hoster" + __version__ = "0.14" + + __pattern__ = r'https?://(?:www\.)?oron\.com/\w{12}' + + __description__ = """Oron.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("chrox", "chrox@pyload.org"), + ("DHMH", "DHMH@pyload.org")] + + +getInfo = create_getInfo(OronCom) diff --git a/module/plugins/hoster/PandaplaNet.py b/module/plugins/hoster/PandaplaNet.py new file mode 100644 index 000000000..78a1ed177 --- /dev/null +++ b/module/plugins/hoster/PandaplaNet.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class PandaplaNet(DeadHoster): + __name__ = "PandaplaNet" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'http://(?:www\.)?pandapla\.net/\w{12}' + + __description__ = """Pandapla.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] + + +getInfo = create_getInfo(PandaplaNet) diff --git a/module/plugins/hoster/PrzeklejPl.py b/module/plugins/hoster/PrzeklejPl.py new file mode 100644 index 000000000..3a59a2c9e --- /dev/null +++ b/module/plugins/hoster/PrzeklejPl.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class PrzeklejPl(DeadHoster): + __name__ = "PrzeklejPl" + __type__ = "hoster" + __version__ = "0.11" + + __pattern__ = r'http://(?:www\.)?przeklej\.pl/plik/.+' + + __description__ = """Przeklej.pl hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + +getInfo = create_getInfo(PrzeklejPl) diff --git a/module/plugins/hoster/RapidfileshareNet.py b/module/plugins/hoster/RapidfileshareNet.py new file mode 100644 index 000000000..ae53411c3 --- /dev/null +++ b/module/plugins/hoster/RapidfileshareNet.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo + + +class RapidfileshareNet(XFSHoster): + __name__ = "RapidfileshareNet" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'http://(?:www\.)?rapidfileshare\.net/\w{12}' + + __description__ = """Rapidfileshare.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "rapidfileshare.net" + + NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>.+?)">' + SIZE_PATTERN = r'>http://www.rapidfileshare.net/\w+?</font> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</font>' + + OFFLINE_PATTERN = r'>No such file with this filename' + TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' + + + def handlePremium(self): + self.fail(_("Premium download not implemented")) + + +getInfo = create_getInfo(RapidfileshareNet) diff --git a/module/plugins/hoster/SharingmatrixCom.py b/module/plugins/hoster/SharingmatrixCom.py new file mode 100644 index 000000000..fa08a4a8f --- /dev/null +++ b/module/plugins/hoster/SharingmatrixCom.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class SharingmatrixCom(DeadHoster): + __name__ = "SharingmatrixCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?sharingmatrix\.com/file/\w+' + + __description__ = """Sharingmatrix.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("paulking", None)] + + +getInfo = create_getInfo(SharingmatrixCom) diff --git a/module/plugins/hoster/StorageTo.py b/module/plugins/hoster/StorageTo.py new file mode 100644 index 000000000..bedc2934f --- /dev/null +++ b/module/plugins/hoster/StorageTo.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class StorageTo(DeadHoster): + __name__ = "StorageTo" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?storage\.to/get/.+' + + __description__ = """Storage.to hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] + + +getInfo = create_getInfo(StorageTo) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py new file mode 100644 index 000000000..409d7b4ca --- /dev/null +++ b/module/plugins/hoster/UpleaCom.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +import re + +from urlparse import urljoin + +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo + + +class UpleaCom(XFSHoster): + __name__ = "UpleaCom" + __type__ = "hoster" + __version__ = "0.04" + + __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' + + __description__ = """Uplea.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Redleon", None)] + + + HOSTER_DOMAIN = "uplea.com" + + NAME_PATTERN = r'class="agmd size18">(?P<N>.+?)<' + SIZE_PATTERN = r'size14">(?P<S>[\d.,]+) (?P<U>[\w^_])</span>' + + OFFLINE_PATTERN = r'>You followed an invalid or expired link' + + LINK_PATTERN = r'"(http?://\w+\.uplea\.com/anonym/.*?)"' + WAIT_PATTERN = r'timeText:([\d.]+),' + VARS_PATTERN = r'class="cel_tbl_step1_foot">\s<a href="(/step/.+)">' + + + def setup(self): + self.multiDL = False + self.chunkLimit = 1 + self.resumeDownload = True + + + def handleFree(self): + m = re.search(self.VARS_PATTERN, self.html) + if m is None: + self.error("VARS_PATTERN not found") + + self.html = self.load(urljoin("http://uplea.com/", m.groups(1))) + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.wait(m.group(1), True) + self.retry() + + m = re.search(self.LINK_PATTERN, self.html) + if m is None: + self.error("LINK_PATTERN not found") + + self.wait(15) + self.download(m.group(1), disposition=True) + + +getInfo = create_getInfo(UpleaCom) diff --git a/module/plugins/hoster/UploadboxCom.py b/module/plugins/hoster/UploadboxCom.py new file mode 100644 index 000000000..031c5f761 --- /dev/null +++ b/module/plugins/hoster/UploadboxCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class UploadboxCom(DeadHoster): + __name__ = "Uploadbox" + __type__ = "hoster" + __version__ = "0.05" + + __pattern__ = r'http://(?:www\.)?uploadbox\.com/files/.+' + + __description__ = """UploadBox.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + +getInfo = create_getInfo(UploadboxCom) diff --git a/module/plugins/hoster/UploadhereCom.py b/module/plugins/hoster/UploadhereCom.py new file mode 100644 index 000000000..8da30be46 --- /dev/null +++ b/module/plugins/hoster/UploadhereCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class UploadhereCom(DeadHoster): + __name__ = "UploadhereCom" + __type__ = "hoster" + __version__ = "0.12" + + __pattern__ = r'http://(?:www\.)?uploadhere\.com/\w{10}' + + __description__ = """Uploadhere.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + +getInfo = create_getInfo(UploadhereCom) diff --git a/module/plugins/hoster/UploadkingCom.py b/module/plugins/hoster/UploadkingCom.py new file mode 100644 index 000000000..743e700eb --- /dev/null +++ b/module/plugins/hoster/UploadkingCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo + + +class UploadkingCom(DeadHoster): + __name__ = "UploadkingCom" + __type__ = "hoster" + __version__ = "0.14" + + __pattern__ = r'http://(?:www\.)?uploadking\.com/\w{10}' + + __description__ = """UploadKing.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + +getInfo = create_getInfo(UploadkingCom) diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py new file mode 100644 index 000000000..38775f519 --- /dev/null +++ b/module/plugins/internal/CaptchaService.py @@ -0,0 +1,209 @@ +# -*- coding: utf-8 -*- + +import re + +from random import random + + +class CaptchaService: + __name__ = "CaptchaService" + __version__ = "0.14" + + __description__ = """Base captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + + + KEY_PATTERN = None + + key = None #: last key detected + + + def __init__(self, plugin): + self.plugin = plugin + + + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = _("%s html not found") % self.__name__ + self.plugin.fail(errmsg) #@TODO: replace all plugin.fail(errmsg) with plugin.error(errmsg) in 0.4.10 + raise TypeError(errmsg) + + m = re.search(self.KEY_PATTERN, html) + if m: + self.key = m.group("KEY") + self.plugin.logDebug("%s key: %s" % (self.__name__, self.key)) + return self.key + else: + self.plugin.logDebug("%s key not found" % self.__name__) + return None + + + def challenge(self, key=None): + raise NotImplementedError + + + def result(self, server, challenge): + raise NotImplementedError + + +class ReCaptcha(CaptchaService): + __name__ = "ReCaptcha" + __version__ = "0.07" + + __description__ = """ReCaptcha captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + + + KEY_PATTERN = r'recaptcha(/api|\.net)/(challenge|noscript)\?k=(?P<KEY>[\w-]+)' + KEY_AJAX_PATTERN = r'Recaptcha\.create\s*\(\s*["\'](?P<KEY>[\w-]+)' + + + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = _("ReCaptcha html not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + m = re.search(self.KEY_PATTERN, html) or re.search(self.KEY_AJAX_PATTERN, html) + if m: + self.key = m.group("KEY") + self.plugin.logDebug("ReCaptcha key: %s" % self.key) + return self.key + else: + self.plugin.logDebug("ReCaptcha key not found") + return None + + + def challenge(self, key=None): + if not key: + if self.detect_key(): + key = self.key + else: + errmsg = _("ReCaptcha key not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={'k': key}) + + try: + challenge = re.search("challenge : '(.+?)',", js).group(1) + server = re.search("server : '(.+?)',", js).group(1) + except: + self.plugin.error("ReCaptcha challenge pattern not found") + + result = self.result(server, challenge) + + return challenge, result + + + def result(self, server, challenge): + return self.plugin.decryptCaptcha("%simage" % server, get={'c': challenge}, + cookies=True, forceUser=True, imgtype="jpg") + + +class AdsCaptcha(CaptchaService): + __name__ = "AdsCaptcha" + __version__ = "0.04" + + __description__ = """AdsCaptcha captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + + + ID_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*CaptchaId=(?P<ID>\d+)' + KEY_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*PublicKey=(?P<KEY>[\w-]+)' + + + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = _("AdsCaptcha html not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + m = re.search(self.ID_PATTERN, html) + n = re.search(self.KEY_PATTERN, html) + if m and n: + self.key = (m.group("ID"), m.group("KEY")) + self.plugin.logDebug("AdsCaptcha id|key: %s | %s" % self.key) + return self.key + else: + self.plugin.logDebug("AdsCaptcha id or key not found") + return None + + + def challenge(self, key=None): #: key is a tuple(CaptchaId, PublicKey) + if not key: + if self.detect_key(): + key = self.key + else: + errmsg = _("AdsCaptcha key not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + CaptchaId, PublicKey = key + + js = self.plugin.req.load("http://api.adscaptcha.com/Get.aspx", get={'CaptchaId': CaptchaId, 'PublicKey': PublicKey}) + + try: + challenge = re.search("challenge: '(.+?)',", js).group(1) + server = re.search("server: '(.+?)',", js).group(1) + except: + self.plugin.error("AdsCaptcha challenge pattern not found") + + result = self.result(server, challenge) + + return challenge, result + + + def result(self, server, challenge): + return self.plugin.decryptCaptcha("%sChallenge.aspx" % server, get={'cid': challenge, 'dummy': random()}, + cookies=True, imgtype="jpg") + + +class SolveMedia(CaptchaService): + __name__ = "SolveMedia" + __version__ = "0.05" + + __description__ = """SolveMedia captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + + + KEY_PATTERN = r'api\.solvemedia\.com/papi/challenge\.(no)?script\?k=(?P<KEY>.+?)["\']' + + + def challenge(self, key=None): + if not key: + if self.detect_key(): + key = self.key + else: + errmsg = _("SolveMedia key not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.noscript", get={'k': key}) + try: + challenge = re.search(r'<input type=hidden name="adcopy_challenge" id="adcopy_challenge" value="([^"]+)">', + html).group(1) + server = "http://api.solvemedia.com/papi/media" + except: + self.plugin.error("SolveMedia challenge pattern not found") + + result = self.result(server, challenge) + + return challenge, result + + + def result(self, server, challenge): + return self.plugin.decryptCaptcha(server, get={'c': challenge}, imgtype="gif") diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py new file mode 100644 index 000000000..ba2c00ec9 --- /dev/null +++ b/module/plugins/internal/XFSAccount.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- + +import re + +from time import gmtime, mktime, strptime +from urlparse import urljoin + +from module.plugins.Account import Account +from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies + + +class XFSAccount(Account): + __name__ = "XFSAccount" + __type__ = "account" + __version__ = "0.25" + + __description__ = """XFileSharing account plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = None + HOSTER_URL = None + + COOKIES = [(HOSTER_DOMAIN, "lang", "english")] + + PREMIUM_PATTERN = r'\(Premium only\)' + + VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:.*?(\d{1,2} [\w^_]+ \d{4})' + + TRAFFIC_LEFT_PATTERN = r'>Traffic available today:.*?<b>\s*(?P<S>[\d.,]+|[Uu]nlimited)\s*(?:(?P<U>[\w^_]+)\s*)?</b>' + TRAFFIC_LEFT_UNIT = "MB" #: used only if no group <U> was found + + LOGIN_FAIL_PATTERN = r'>(Incorrect Login or Password|Error<)' + + + def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 + self.init() + return super(XFSAccount, self).__init__(manager, accounts) + + + def init(self): + # if not self.HOSTER_DOMAIN: + # self.fail(_("Missing HOSTER_DOMAIN")) + + if not self.HOSTER_URL: + self.HOSTER_URL = "http://www.%s/" % self.HOSTER_DOMAIN + + + def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = None + premium = None + + html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) + + premium = True if re.search(self.PREMIUM_PATTERN, html) else False + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%d %B %Y")) + + except Exception, e: + self.logError(e) + + else: + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = None #: registered account type (not premium) + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + try: + traffic = m.groupdict() + size = traffic['S'] + + if "nlimited" in size: + trafficleft = -1 + if validuntil is None: + validuntil = -1 + else: + if 'U' in traffic: + unit = traffic['U'] + elif isinstance(self.TRAFFIC_LEFT_UNIT, basestring): + unit = self.TRAFFIC_LEFT_UNIT + else: + unit = "" + + trafficleft = self.parseTraffic(size + unit) + + except Exception, e: + self.logError(e) + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + + + def login(self, user, data, req): + if isinstance(self.COOKIES, list): + set_cookies(req.cj, self.COOKIES) + + url = urljoin(self.HOSTER_URL, "login.html") + html = req.load(url, decode=True) + + action, inputs = parseHtmlForm('name="FL"', html) + if not inputs: + inputs = {'op': "login", + 'redirect': self.HOSTER_URL} + + inputs.update({'login': user, + 'password': data['password']}) + + html = req.load(self.HOSTER_URL, post=inputs, decode=True) + + if re.search(self.LOGIN_FAIL_PATTERN, html): + self.wrongPassword() diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py new file mode 100644 index 000000000..62fd8c017 --- /dev/null +++ b/module/plugins/internal/XFSCrypter.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class XFSCrypter(SimpleCrypter): + __name__ = "XFSCrypter" + __type__ = "crypter" + __version__ = "0.04" + + __pattern__ = r'^unmatchable$' + + __description__ = """XFileSharing decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = None + HOSTER_NAME = None + + URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')] + + COOKIES = [(HOSTER_DOMAIN, "lang", "english")] + + LINK_PATTERN = r'<(?:td|TD).*?>\s*<a href="(.+?)".*?>.+?(?:</a>)?\s*</(?:td|TD)>' + NAME_PATTERN = r'<[tT]itle>.*?\: (?P<N>.+) folder</[tT]itle>' + + OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' + TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)' diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py new file mode 100644 index 000000000..f54bb5e45 --- /dev/null +++ b/module/plugins/internal/XFSHoster.py @@ -0,0 +1,345 @@ +# -*- coding: utf-8 -*- + +import re + +from random import random +from time import sleep + +from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME + +from module.plugins.hoster.UnrestrictLi import secondsToMidnight +from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.utils import html_unescape + + +class XFSHoster(SimpleHoster): + __name__ = "XFSHoster" + __type__ = "hoster" + __version__ = "0.15" + + __pattern__ = r'^unmatchable$' + + __description__ = """XFileSharing hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = None + HOSTER_NAME = None + + URL_REPLACEMENTS = [(r'/(?:embed-)?(\w{12}).*', r'/\1')] #: plus support embedded files + + COOKIES = [(HOSTER_DOMAIN, "lang", "english")] + + INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>' + NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"' + SIZE_PATTERN = r'You have requested .*\((?P<S>[\d.,]+) ?(?P<U>[\w^_]+)?\)</font>' + + OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' + TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)' + + WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>' + + OVR_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)' + LINK_PATTERN = None #: final download url pattern + + CAPTCHA_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)' + CAPTCHA_DIV_PATTERN = r'>Enter code.*?<div.*?>(.+?)</div>' + RECAPTCHA_PATTERN = None + SOLVEMEDIA_PATTERN = None + + ERROR_PATTERN = r'(?:class=["\']err["\'][^>]*>|<[Cc]enter><b>)(.+?)(?:["\']|</)|>\(ERROR:(.+?)\)' + + + def setup(self): + self.chunkLimit = 1 + self.resumeDownload = self.multiDL = self.premium + + + def prepare(self): + """ Initialize important variables """ + if not self.HOSTER_DOMAIN: + self.fail(_("Missing HOSTER_DOMAIN")) + + if not self.HOSTER_NAME: + self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) + + if not self.LINK_PATTERN: + pattern = r'(https?://(www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<]' + self.LINK_PATTERN = pattern % self.HOSTER_DOMAIN.replace('.', '\.') + + self.captcha = None + self.errmsg = None + self.passwords = self.getPassword().splitlines() + + if (self.__pattern__ != self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] + and re.match(self.__pattern__, self.pyfile.url) is None): + self.logInfo(_("Multi hoster detected")) + if self.premium: + self.logDebug(_("Looking for download link...")) + self.handleOverriden() + else: + self.fail(_("Only premium users can use url leech feature")) + + return super(XFSHoster, self).prepare() + + + def handleFree(self): + link = self.getDownloadLink() + + if link: + if self.captcha: + self.correctCaptcha() + + self.download(link, ref=True, cookies=True, disposition=True) + + elif self.errmsg: + if 'captcha' in self.errmsg: + self.fail(_("No valid captcha code entered")) + else: + self.fail(self.errmsg) + + else: + self.fail(_("Download link not found")) + + + def handlePremium(self): + return self.handleFree() + + + def getDownloadLink(self): + for i in xrange(1, 5): + self.logDebug("Getting download link: #%d" % i) + + self.checkErrors() + + m = re.search(self.LINK_PATTERN, self.html, re.S) + if m: + break + + data = self.getPostParameters() + + # sleep(10) + + self.req.http.c.setopt(FOLLOWLOCATION, 0) + + self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True) + self.header = self.req.http.header + + self.req.http.c.setopt(FOLLOWLOCATION, 1) + + m = re.search(r'Location\s*:\s*(.+)', self.header, re.I) + if m: + break + + m = re.search(self.LINK_PATTERN, self.html, re.S) + if m: + break + else: + return + + self.errmsg = None + + return m.group(1).strip() #@TODO: Remove .strip() in 0.4.10 + + + def handleOverriden(self): + #only tested with easybytez.com + self.html = self.load("http://www.%s/" % self.HOSTER_DOMAIN) + + action, inputs = self.parseHtmlForm('') + + upload_id = "%012d" % int(random() * 10 ** 12) + action += upload_id + "&js_on=1&utype=prem&upload_type=url" + + inputs['tos'] = '1' + inputs['url_mass'] = self.pyfile.url + inputs['up1oad_type'] = 'url' + + self.logDebug(action, inputs) + + self.req.setOption("timeout", 600) #: wait for file to upload to easybytez.com + + self.html = self.load(action, post=inputs) + + self.checkErrors() + + action, inputs = self.parseHtmlForm('F1') + if not inputs: + if self.errmsg: + self.retry(reason=self.errmsg) + else: + self.error(_("TEXTAREA F1 not found")) + + self.logDebug(inputs) + + stmsg = inputs['st'] + + if stmsg == 'OK': + self.html = self.load(action, post=inputs) + + elif 'Can not leech file' in stmsg: + self.retry(20, 3 * 60, _("Can not leech file")) + + elif 'today' in stmsg: + self.retry(wait_time=secondsToMidnight(gmt=2), reason=_("You've used all Leech traffic today")) + + else: + self.fail(stmsg) + + #get easybytez.com link for uploaded file + m = re.search(self.OVR_LINK_PATTERN, self.html) + if m is None: + self.error(_("OVR_LINK_PATTERN not found")) + + header = self.load(m.group(1).strip(), just_header=True, decode=True) #@TODO: Remove .strip() in 0.4.10 + if 'location' in header: #: Direct download link + self.download(header['location'], ref=True, cookies=True, disposition=True) + else: + self.fail(_("Download link not found")) + + + def checkErrors(self): + m = re.search(self.ERROR_PATTERN, self.html) + + if m is None: + self.errmsg = None + else: + self.errmsg = m.group(1) + + self.logWarning(re.sub(r"<.*?>", " ", self.errmsg)) + + if 'wait' in self.errmsg: + wait_time = sum([int(v) * {"hour": 3600, "minute": 60, "second": 1}[u] for v, u in + re.findall(r'(\d+)\s*(hour|minute|second)', self.errmsg)]) + self.wait(wait_time, True) + + elif 'captcha' in self.errmsg: + self.invalidCaptcha() + + elif 'premium' in self.errmsg and 'require' in self.errmsg: + self.fail(_("File can be downloaded by premium users only")) + + elif 'limit' in self.errmsg: + if 'days' in self.errmsg: + delay = secondsToMidnight(gmt=2) + retries = 3 + else: + delay = 1 * 60 * 60 + retries = 25 + + self.wait(delay, True) + self.retry(retries, reason=_("Download limit exceeded")) + + elif 'countdown' in self.errmsg or 'Expired' in self.errmsg: + self.retry(reason=_("Link expired")) + + elif 'maintenance' in self.errmsg or 'maintainance' in self.errmsg: + self.tempOffline() + + elif 'download files up to' in self.errmsg: + self.fail(_("File too large for free download")) + + else: + self.retry(wait_time=60, reason=self.errmsg) + + return self.errmsg + + + def getPostParameters(self): + for _i in xrange(3): + if hasattr(self, "FORM_PATTERN"): + action, inputs = self.parseHtmlForm(self.FORM_PATTERN) + else: + action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) + + if not inputs: + action, inputs = self.parseHtmlForm('F1') + if not inputs: + if self.errmsg: + self.retry(reason=self.errmsg) + else: + self.error(_("TEXTAREA F1 not found")) + + self.logDebug(inputs) + + if 'op' in inputs and inputs['op'] in ("download2", "download3"): + if "password" in inputs: + if self.passwords: + inputs['password'] = self.passwords.pop(0) + else: + self.fail(_("No or invalid passport")) + + if not self.premium: + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait_time = int(m.group(1)) + self.setWait(wait_time, False) + else: + wait_time = 0 + + self.captcha = self.handleCaptcha(inputs) + + if wait_time: + self.wait() + + return inputs + else: + inputs['referer'] = self.pyfile.url + + if self.premium: + inputs['method_premium'] = "Premium Download" + if 'method_free' in inputs: + del inputs['method_free'] + else: + inputs['method_free'] = "Free Download" + if 'method_premium' in inputs: + del inputs['method_premium'] + + self.html = self.load(self.pyfile.url, post=inputs, ref=True) + else: + self.error(_("FORM: %s") % (inputs['op'] if 'op' in inputs else _("UNKNOWN"))) + + + def handleCaptcha(self, inputs): + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: + captcha_url = m.group(1) + inputs['code'] = self.decryptCaptcha(captcha_url) + return 1 + + m = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.S) + if m: + captcha_div = m.group(1) + self.logDebug(captcha_div) + numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div)) + inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))]) + self.logDebug("Captcha code: %s" % inputs['code'], numerals) + return 2 + + recaptcha = ReCaptcha(self) + try: + captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1) + except: + captcha_key = recaptcha.detect_key() + + if captcha_key: + self.logDebug("ReCaptcha key: %s" % captcha_key) + inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) + return 3 + + solvemedia = SolveMedia(self) + try: + captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.html).group(1) + except: + captcha_key = solvemedia.detect_key() + + if captcha_key: + self.logDebug("SolveMedia key: %s" % captcha_key) + inputs['adcopy_challenge'], inputs['adcopy_response'] = solvemedia.challenge(captcha_key) + return 4 + + return 0 |