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 /pyload/plugins/hoster/NetloadIn.py | |
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 'pyload/plugins/hoster/NetloadIn.py')
-rw-r--r-- | pyload/plugins/hoster/NetloadIn.py | 80 |
1 files changed, 44 insertions, 36 deletions
diff --git a/pyload/plugins/hoster/NetloadIn.py b/pyload/plugins/hoster/NetloadIn.py index d6b1b77e2..5889611bb 100644 --- a/pyload/plugins/hoster/NetloadIn.py +++ b/pyload/plugins/hoster/NetloadIn.py @@ -26,10 +26,11 @@ def getInfo(urls): api = getURL(apiurl + ids, decode=True) if api is None or len(api) < 10: - print "Netload prefetch: failed " + self.logDebug("Prefetch failed") return if api.find("unknown_auth") >= 0: - print "Netload prefetch: Outdated auth code " + print + self.logDebug("Outdated auth code") return result = [] @@ -43,34 +44,36 @@ def getInfo(urls): size = 0 result.append((tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i])) except: - print "Netload prefetch: Error while processing response: " - print r + self.logDebug("Error while processing response: %s" % r) yield result class NetloadIn(Hoster): - __name__ = "NetloadIn" - __type__ = "hoster" + __name__ = "NetloadIn" + __type__ = "hoster" __version__ = "0.45" - __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)' + __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index\.php?id=10&file_id=)' __description__ = """Netload.in hoster plugin""" - __authors__ = [("spoob", "spoob@pyload.org"), - ("RaNaN", "ranan@pyload.org"), - ("Gregy", "gregy@gregy.cz")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("RaNaN", "ranan@pyload.org"), + ("Gregy", "gregy@gregy.cz")] def setup(self): self.multiDL = self.resumeDownload = self.premium + def process(self, pyfile): self.url = pyfile.url self.prepare() pyfile.setStatus("downloading") self.proceed(self.url) + def prepare(self): self.download_api_data() @@ -78,7 +81,7 @@ class NetloadIn(Hoster): self.pyfile.name = self.api_data['filename'] if self.premium: - self.logDebug("Netload: Use Premium Account") + self.logDebug("Use Premium Account") settings = self.load("http://www.netload.in/index.php?id=2&lang=en") if '<option value="2" selected="selected">Direkter Download' in settings: self.logDebug("Using direct download") @@ -89,9 +92,10 @@ class NetloadIn(Hoster): if self.download_html(): return True else: - self.fail("Failed") + self.fail(_("Failed")) return False + def download_api_data(self, n=0): url = self.url id_regex = re.compile(self.__pattern__) @@ -106,18 +110,18 @@ class NetloadIn(Hoster): return apiurl = "http://api.netload.in/info.php" - src = self.load(apiurl, cookies=False, + html = self.load(apiurl, cookies=False, get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", "md5": "1"}, decode=True).strip() - if not src and n <= 3: + if not html and n <= 3: sleep(0.2) self.download_api_data(n + 1) return - self.logDebug("Netload: APIDATA: " + src) + self.logDebug("APIDATA: " + html) self.api_data = {} - if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."): - lines = src.split(";") + if html and ";" in html and html not in ("unknown file_data", "unknown_server_data", "No input file specified."): + lines = html.split(";") self.api_data['exists'] = True self.api_data['fileid'] = lines[0] self.api_data['filename'] = lines[1] @@ -133,20 +137,22 @@ class NetloadIn(Hoster): else: self.api_data = False + def final_wait(self, page): wait_time = self.get_wait_time(page) self.setWait(wait_time) - self.logDebug("Netload: final wait %d seconds" % wait_time) + self.logDebug("Final wait %d seconds" % wait_time) self.wait() self.url = self.get_file_url(page) + def download_html(self): - self.logDebug("Netload: Entering download_html") + self.logDebug("Entering download_html") page = self.load(self.url, decode=True) t = time() + 30 if "/share/templates/download_hddcrash.tpl" in page: - self.logError("Netload HDD Crash") + self.logError(_("Netload HDD Crash")) self.fail(_("File temporarily not available")) if not self.api_data: @@ -155,7 +161,7 @@ class NetloadIn(Hoster): if "* The file was deleted" in page: self.offline() - name = re.search(r'class="dl_first_filename">([^<]+)', page, re.MULTILINE) + name = re.search(r'class="dl_first_filename">([^<]+)', page, re.M) # the found filename is not truncated if name: name = name.group(1).strip() @@ -170,28 +176,27 @@ class NetloadIn(Hoster): t = time() + 30 if "/share/templates/download_hddcrash.tpl" in page: - self.logError("Netload HDD Crash") + self.logError(_("Netload HDD Crash")) self.fail(_("File temporarily not available")) - self.logDebug("Netload: try number %d " % i) + self.logDebug("Try number %d " % i) if ">Your download is being prepared.<" in page: - self.logDebug("Netload: We will prepare your download") + self.logDebug("We will prepare your download") self.final_wait(page) return True if ">An access request has been made from IP address <" in page: wait = self.get_wait_time(page) if not wait: - self.logDebug("Netload: Wait was 0 setting 30") + self.logDebug("Wait was 0 setting 30") wait = 30 * 60 - self.logInfo(_("Netload: waiting between downloads %d s." % wait)) - self.wantReconnect = True - self.setWait(wait) + self.logInfo(_("Waiting between downloads %d seconds") % wait) + self.setWait(wait, True) self.wait() return self.download_html() - self.logDebug("Netload: Trying to find captcha") + self.logDebug("Trying to find captcha") try: url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&.*&captcha=1)', @@ -204,7 +209,7 @@ class NetloadIn(Hoster): page = self.load(url_captcha_html, cookies=True) captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', page).group(1) except: - self.logDebug("Netload: Could not find captcha, try again from beginning") + self.logDebug("Could not find captcha, try again from beginning") captchawaited = False continue @@ -215,7 +220,7 @@ class NetloadIn(Hoster): self.pyfile.waitUntil = time() # dont wait contrary to time on website else: self.pyfile.waitUntil = t - self.logInfo(_("Netload: waiting for captcha %d s.") % (self.pyfile.waitUntil - time())) + self.logInfo(_("Waiting for captcha %d seconds") % (self.pyfile.waitUntil - time())) #self.setWait(wait) self.wait() captchawaited = True @@ -226,27 +231,30 @@ class NetloadIn(Hoster): return False + def get_file_url(self, page): try: - file_url_pattern = r"<a class=\"Orange_Link\" href=\"(http://.+)\".?>Or click here" + file_url_pattern = r'<a class="Orange_Link" href="(http://.+)".?>Or click here' attempt = re.search(file_url_pattern, page) if attempt is not None: return attempt.group(1) else: - self.logDebug("Netload: Backup try for final link") - file_url_pattern = r"<a href=\"(.+)\" class=\"Orange_Link\">Click here" + self.logDebug("Backup try for final link") + file_url_pattern = r'<a href="(.+)" class="Orange_Link">Click here' attempt = re.search(file_url_pattern, page) return "http://netload.in/" + attempt.group(1) except: - self.logDebug("Netload: Getting final link failed") + self.logDebug("Getting final link failed") return None + def get_wait_time(self, page): wait_seconds = int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 return wait_seconds + def proceed(self, url): - self.logDebug("Netload: Downloading..") + self.logDebug("Downloading..") self.download(url, disposition=True) |