void Cramit::checkWaitTime() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QString response(reply->readAll()); if (response.contains("You have to wait")) { int mins = response.section("You have to wait ", 1, 1).section(" minutes", 0, 0).toInt(); int secs = response.section(" seconds before your next download", 0, 0).section(' ', 1, 1).toInt(); this->startWait((mins * 60000) + (secs + 1000)); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else if (response.contains("Enter the code below")) { m_captchaKey = response.section("rand\" value=\"", 1, 1).section('"', 0, 0); if (m_captchaKey.isEmpty()) { emit error(UnknownError); } else { emit statusChanged(CaptchaRequired); } } else { emit error(UnknownError); } reply->deleteLater(); }
void OneFichier::checkDownloadLink() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QUrl redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); if (!redirect.isEmpty()) { emit downloadRequestReady(QNetworkRequest(redirect)); } else { QString response(reply->readAll()); QRegExp re("must wait \\d+ minutes"); if (re.indexIn(response) >= 0) { int mins = re.cap().section("must wait ", 1, 1).section(' ', 0, 0).toInt(); if (mins > 0) { this->startWait(mins * 61000); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else { emit error(UnknownError); } } else { emit error(UnknownError); } } reply->deleteLater(); }
void FileBoom::checkWaitTime() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QRegExp re("(http://fboom.me|)/file/url.html\\?file=[^'\"]+"); QString redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toString(); if (re.indexIn(redirect) == 0) { QUrl url(re.cap()); if (url.host().isEmpty()) { url.setScheme("http"); url.setHost("fboom.me"); } emit downloadRequestReady(QNetworkRequest(url)); } else { QString response(reply->readAll()); if (re.indexIn(response) >= 0) { QUrl url(re.cap()); if (url.host().isEmpty()) { url.setScheme("http"); url.setHost("fboom.me"); } emit downloadRequestReady(QNetworkRequest(url)); } else if (response.contains("Downloading is not possible")) { QTime time = QTime::fromString(response.section("Please wait", 1, 1).section("to download", 0, 0).trimmed(), "hh:mm:ss"); if (time.isValid()) { this->startWait(QTime::currentTime().msecsTo(time)); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else { emit error(UnknownError); } } else { m_captchaKey = response.section("/file/captcha.html?v=", 1, 1).section('"', 0, 0); if (m_captchaKey.isEmpty()) { emit error(UnknownError); } else { emit statusChanged(CaptchaRequired); } } } reply->deleteLater(); }
void MegaShares::onWebPageDownloaded() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QRegExp re("http://webprod\\d+\\.megashares.com/[^'\"]+"); QString redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toString(); if (re.indexIn(redirect) == 0) { QNetworkRequest request; request.setUrl(QUrl(re.cap())); emit downloadRequestReady(request); } else if (!redirect.isEmpty()) { this->getDownloadRequest(QUrl(redirect)); } else { QString response(reply->readAll()); if (re.indexIn(response) >= 0) { m_downloadUrl.setUrl(re.cap()); if (response.contains("Your Passport needs to be reactivated")) { m_captchaKey = response.section("random_num\" value=\"", 1, 1).section('"', 0, 0); m_passportKey = response.section("passport_num\" value=\"", 1, 1).section('"', 0, 0); if ((m_captchaKey.isEmpty()) || (m_passportKey.isEmpty())) { emit error(UnknownError); } else { emit statusChanged(CaptchaRequired); } } else { emit downloadRequestReady(QNetworkRequest(m_downloadUrl)); } } else { QString errorString = response.section("class=\"red\">", 1, 1).section('<', 0, 0); if (errorString.startsWith("Invalid link")) { emit error(NotFound); } else if (errorString.startsWith("All download slots")) { this->startWait(600000); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else { emit error(UnknownError); } } } reply->deleteLater(); }
void DepositFiles::onWebPageDownloaded() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QRegExp re("http(s|)://fileshare\\d+.(depositfiles.com|dfiles.\\w+)/[^'\"]+"); QString redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toString(); if (re.indexIn(redirect) == 0) { QNetworkRequest request; request.setUrl(QUrl(re.cap())); emit downloadRequestReady(request); } else if (!redirect.isEmpty()) { this->getDownloadRequest(QUrl(redirect)); } else { QString response(reply->readAll()); if (re.indexIn(response) >= 0) { QNetworkRequest request; request.setUrl(QUrl(re.cap())); emit downloadRequestReady(request); } else if (response.contains("html_download_api-limit_interval")) { int secs = response.section("html_download_api-limit_interval\">", 1, 1).section('<', 0, 0).toInt(); if (secs > 0) { this->startWait(secs * 1000); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else { emit error(UrlError); } } else { m_fileId = response.section("var fid = '", 1, 1).section('\'', 0, 0); if (m_fileId.isEmpty()) { if (response.contains("file does not exist")) { emit error(NotFound); } else { emit error(UrlError); } } else { this->startWait(60000); this->connect(this, SIGNAL(waitFinished()), this, SLOT(getCaptchaKey())); } } } reply->deleteLater(); }
void FShare::checkDownloadLink() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QRegExp re("http(s|)://download\\d+.fshare.vn/download/[^'\"]+"); QString response(reply->readAll()); if (re.indexIn(response) >= 0) { m_downloadUrl.setUrl(re.cap()); int secs = response.section("var count = ", 1, 1).section(';', 0, 0).toInt(); if (secs > 0) { this->startWait(secs * 1000); if (secs > 30) { this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else { this->connect(this, SIGNAL(waitFinished()), this, SLOT(startDownload())); } } else { emit error(UnknownError); } } else if (response.contains("GUEST")) { this->startWait(600000); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else { emit error(UnknownError); } reply->deleteLater(); }
void OneFichier::onWebPageDownloaded() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QRegExp re("http(s|)://\\w-\\d.1fichier.com/[^'\"]+"); QString redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toString(); if (re.indexIn(redirect) == 0) { QNetworkRequest request; request.setUrl(QUrl(re.cap())); emit downloadRequestReady(request); } else if (!redirect.isEmpty()) { this->getDownloadRequest(QUrl(redirect)); } else { QString response(reply->readAll()); if (re.indexIn(response) >= 0) { QNetworkRequest request; request.setUrl(QUrl(re.cap())); emit downloadRequestReady(request); } else { QRegExp re("must wait \\d+ minutes"); if (re.indexIn(response) >= 0) { int mins = re.cap().section("must wait ", 1, 1).section(' ', 0, 0).toInt(); if (mins > 0) { this->startWait(mins * 61000); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else { emit error(UnknownError); } } else { this->getDownloadLink(reply->request().url()); } } } reply->deleteLater(); }
void FilesToShare::checkWaitTime() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QString response(reply->readAll()); int mins = 0; int secs = 0; if (response.contains("You have to wait")) { mins = response.section("You have to wait ", 1, 1).section(" minutes", 0, 0).toInt(); secs = response.section(" seconds before your next download", 0, 0).section(' ', 1, 1).toInt(); this->startWait((mins * 60000) + (secs + 1000)); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else if (response.contains("You can download files up to ")) { emit error(TrafficExceeded); } else if (response.contains("premium account to download this file")) { this->setErrorString(tr("Premium account required")); emit error(UnknownError); } else { secs = response.section(QRegExp("countdown_str\">Wait <span id=\"\\w+\">"), 1, 1).section('<', 0, 0).toInt(); m_rand = response.section("rand\" value=\"", 1, 1).section('"', 0, 0); m_captchaKey = response.section("api.solvemedia.com/papi/challenge.noscript?k=", 1, 1).section('"', 0, 0); if ((m_rand.isEmpty()) || (m_captchaKey.isEmpty())) { emit error(UnknownError); } else { if (secs > 0) { m_waitTime = secs * 1000; this->startWait(m_waitTime); this->connect(this, SIGNAL(waitFinished()), this, SLOT(downloadCaptcha())); } else { emit statusChanged(CaptchaRequired); } } } reply->deleteLater(); }
void Uploadtous::onCaptchaSubmitted() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QRegExp re("http://storage\\d+.(uploadto.us|ultramegabit.com)/[^'\"]+"); QString redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toString(); if (redirect.isEmpty()) { redirect = reply->header(QNetworkRequest::LocationHeader).toString(); } if (re.indexIn(redirect) == 0) { QNetworkRequest request; request.setUrl(QUrl(re.cap())); emit downloadRequestReady(request); } else if (redirect.contains("delay")) { this->startWait(600000); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else { QString response(reply->readAll()); if (re.indexIn(response) >= 0) { QNetworkRequest request; request.setUrl(QUrl(re.cap())); emit downloadRequestReady(request); } else if (response.contains("check_recaptcha")) { emit error(CaptchaError); } else { emit error(UnknownError); } } reply->deleteLater(); }
BatteryControllerUpdater::BatteryControllerUpdater(BatteryController *mBatteryController, ModbusRtu *modbus, QObject *parent): QObject(parent), mBatteryController(mBatteryController), mDeviceAddress(mBatteryController->DeviceAddress()), mRegisterCount(0), mUpdatingController(false), mModbus(0), mAcquisitionTimer(new QTimer(this)), mTimeoutCount(0), mState(Init), mTmpState(Wait) { Q_ASSERT(mBatteryController != 0); mModbus = modbus; connect(mModbus, SIGNAL(readCompleted(int, quint8, const QList<quint16> &)), this, SLOT(onReadCompleted(int, quint8, QList<quint16>))); connect(mModbus, SIGNAL(writeCompleted(int, quint8, quint16, quint16)), this, SLOT(onWriteCompleted(int, quint8, quint16, quint16))); connect(mModbus, SIGNAL(errorReceived(int, quint8, int)), this, SLOT(onErrorReceived(int, quint8, int))); connect(mAcquisitionTimer, SIGNAL(timeout()), this, SLOT(onWaitFinished())); connect(mBatteryController, SIGNAL(clearStatusRegisterFlagsChanged()), this, SLOT(onClearStatusRegisterFlagsChanged())); connect(mBatteryController, SIGNAL(operationalModeChanged()), this, SLOT(onOperationalModeChanged())); connect(mBatteryController, SIGNAL(requestDelayedSelfMaintenanceChanged()), this, SLOT(onRequestDelayedSelfMaintenanceChanged())); connect(mBatteryController, SIGNAL(requestImmediateSelfMaintenanceChanged()), this, SLOT(onRequestImmediateSelfMaintenanceChanged())); connect(mBatteryController, SIGNAL(deviceAddressChanged()), this, SLOT(onDeviceAddressChanged())); mAcquisitionTimer->setSingleShot(true); mStopwatch.start(); startNextAction(); }
void MegaShares::onWaitFinished() { emit statusChanged(Ready); this->disconnect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); }
void FileDefend::checkCaptcha() { QNetworkReply *reply = qobject_cast<QNetworkReply*>(this->sender()); if (!reply) { emit error(NetworkError); return; } QRegExp re("http://\\w+.filedefend.com:\\d+/d/[^'\"]+"); QString redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toString(); if (re.indexIn(redirect) == 0) { QNetworkRequest request; request.setUrl(QUrl(re.cap())); emit downloadRequestReady(request); } else if (!redirect.isEmpty()) { this->getDownloadRequest(QUrl(redirect)); } else { QString response(reply->readAll()); if (re.indexIn(response) >= 0) { QNetworkRequest request; request.setUrl(QUrl(re.cap())); emit downloadRequestReady(request); } else { m_rand = response.section("rand\" value=\"", 1, 1).section('"', 0, 0); QString codeBlock = response.section("Enter code below", 1, 1).section("</span></div>", 0, 0); QStringList codeList = codeBlock.split("padding-left:", QString::SkipEmptyParts); if (!codeList.isEmpty()) { codeList.removeFirst(); QMap<int, QString> codeMap; int i = 1; while ((!codeList.isEmpty()) && (i < 5)) { QString code = codeList.takeFirst(); int key = code.section('p', 0, 0).toInt(); QString value = QString::number(code.section(">&#", 1, 1).left(2).toInt() - 48); codeMap[key] = value; i++; } QList<int> codeKeys = codeMap.keys(); qSort(codeKeys.begin(), codeKeys.end()); foreach (int key, codeKeys) { m_code.append(codeMap[key]); } } if ((m_rand.isEmpty()) || (m_code.isEmpty())) { QString errorString = response.section("<div class=\"err\">", 1, 1).section('<', 0, 0); if (!errorString.isEmpty()) { if (errorString.startsWith("You have to wait")) { int mins = errorString.section(" minutes", 0, 0).section(' ', -1).toInt(); int secs = errorString.section(" seconds", 0, 0).section(' ', -1).toInt(); this->startWait((mins * 60000) + (secs * 1000)); this->connect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); } else { emit error(UnknownError); } } else { emit error(UnknownError); } } else { this->startWait(45000); this->connect(this, SIGNAL(waitFinished()), this, SLOT(submitCaptcha())); } }
void OneFichier::onWaitFinished() { emit statusChanged(Ready); this->disconnect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); }
void FileBoom::onWaitFinished() { emit statusChanged(Ready); this->disconnect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); }
void Uploadtous::onWaitFinished() { emit statusChanged(Ready); this->disconnect(this, SIGNAL(waitFinished()), this, SLOT(onWaitFinished())); }