에러메세지 처리
SendIpList 수행 git-svn-id: svn://192.168.0.12/source@156 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 3.3.0, 2015-06-05T18:05:10. -->
|
<!-- Written by QtCreator 3.3.0, 2015-07-06T17:29:37. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
@@ -227,7 +227,7 @@
|
|||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">ProxyProcess</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">ProxyProcess</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/source/ProxyProcess/ProxyProcess.pro</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/source/ProxyProcess/ProxyProcess.pro</value>
|
||||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments">"http://www.proxylists.net/us_102_ext.html"</value>
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments">"http://free-proxy.cz/en/proxylist/country/all/http/speed/level2"</value>
|
||||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">ProxyProcess.pro</value>
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">ProxyProcess.pro</value>
|
||||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
|
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ void SCrawler::saveResult(bool ok)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debug("c:/data/test3.html", m_page->currentFrame()->toHtml());
|
||||||
|
|
||||||
|
|
||||||
QString strIpList;
|
QString strIpList;
|
||||||
if(m_strUrl.contains("hidemyass"))
|
if(m_strUrl.contains("hidemyass"))
|
||||||
{
|
{
|
||||||
@@ -108,11 +111,30 @@ void SCrawler::saveResult(bool ok)
|
|||||||
if(strIpList.trimmed().size() > 0)
|
if(strIpList.trimmed().size() > 0)
|
||||||
cout << strIpList.trimmed().toStdString();
|
cout << strIpList.trimmed().toStdString();
|
||||||
|
|
||||||
|
// success to crawling
|
||||||
if(strIpList.size() > 8)
|
if(strIpList.size() > 8)
|
||||||
{
|
{
|
||||||
cout << endl << "ok";
|
// in case sending iplist to db
|
||||||
|
if(m_strLocation.compare("local") != 0)
|
||||||
|
{
|
||||||
|
// success to send ip list to db
|
||||||
|
if(SendIpList(strIpList))
|
||||||
|
{
|
||||||
|
cout << endl << "uok";
|
||||||
|
}
|
||||||
|
// fail to sen ip list to db
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cout << endl << "fok";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// in case not sending iplist to db
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cout << endl << "ok";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// fail to crawling
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout << "sitedown";
|
cout << "sitedown";
|
||||||
@@ -386,7 +408,7 @@ QString SCrawler::getIpListFromProxylists(const QWebElement _FindElement)
|
|||||||
return totalResult.trimmed();
|
return totalResult.trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
bool SCrawler::SendIpList(QString _strIpList)
|
bool SCrawler::SendIpList(QString _strIpList)
|
||||||
{
|
{
|
||||||
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
||||||
@@ -442,6 +464,65 @@ bool SCrawler::SendIpList(QString _strIpList)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool SCrawler::SendIpList(QString _strIpList)
|
||||||
|
{
|
||||||
|
|
||||||
|
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
||||||
|
db.setHostName("bigbird.iptime.org");
|
||||||
|
db.setUserName("admin");
|
||||||
|
db.setPassword("admin123");
|
||||||
|
db.setDatabaseName("concepters");
|
||||||
|
|
||||||
|
if (db.open() == false)
|
||||||
|
{
|
||||||
|
qDebug() << "DB open Failed in SendIpList()";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSqlQuery sql;
|
||||||
|
//QString strQuery = "truncate table Proxy";
|
||||||
|
/*
|
||||||
|
QString strQuery = "delete from Proxy";
|
||||||
|
QString strUtf8(strQuery.toUtf8());
|
||||||
|
|
||||||
|
if (sql.exec(strUtf8) == false)
|
||||||
|
{
|
||||||
|
p_labelStatus->setText("Delete Query\n Fail");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
QString strQuery;
|
||||||
|
QString strUtf8;
|
||||||
|
QStringList _slIpList = _strIpList.split("\n");
|
||||||
|
foreach(QString str, _slIpList)
|
||||||
|
{
|
||||||
|
strQuery = "insert into Proxy set Proxy='";
|
||||||
|
strQuery += str.split(',').at(0).trimmed();
|
||||||
|
strQuery += "', Port=";
|
||||||
|
strQuery += str.split(',').at(1).trimmed();
|
||||||
|
if(str.split(',').size() > 2)
|
||||||
|
{
|
||||||
|
strQuery += ", Source='";
|
||||||
|
strQuery += str.split(',').at(2).trimmed();
|
||||||
|
strQuery += "'";
|
||||||
|
}
|
||||||
|
strUtf8 = strQuery.toUtf8();
|
||||||
|
if (sql.exec(strUtf8) == false)
|
||||||
|
{
|
||||||
|
//InsertLog(sql.lastQuery() + "is Failed");
|
||||||
|
//return false;
|
||||||
|
cerr << sql.lastQuery().toStdString() << endl;
|
||||||
|
//cout << "PP send ip list failed" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//cout << "PP send ip list : " << _slIpList.size() << endl;
|
||||||
|
db.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QList<QWebElement> SCrawler::FindAllMid(const QWebElement _FindElement,const QString _strElement,const QString _strAttrib,const QString _strFind, const int _strStart, const int _strLength)
|
QList<QWebElement> SCrawler::FindAllMid(const QWebElement _FindElement,const QString _strElement,const QString _strAttrib,const QString _strFind, const int _strStart, const int _strLength)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user