검색시 출처 기능 추가

git-svn-id: svn://192.168.0.12/source@8 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
admin
2015-01-15 01:42:45 +00:00
parent ff0629cde1
commit 3f085c0abc

View File

@@ -278,13 +278,14 @@ enum E_DATA
E_DATA_TITLE,
E_DATA_DATE,
E_DATA_DATA,
E_DATA_PLATFORM_TITLE,
E_DATA_MAX,
};
void SCrawler::saveFrameUrl(QWebFrame *frame)
{
static int cz = 0;
Debug(frame->frameName() + QString::number(cz++) + ".html",frame->toHtml());
//static int cz = 0;
//Debug(frame->frameName() + QString::number(cz++) + ".html",frame->toHtml());
QSqlQuery sql;
if (frame->frameName().compare(QString("BuddyConnectIframe")) == 0)
@@ -312,14 +313,11 @@ void SCrawler::saveFrameUrl(QWebFrame *frame)
if (frame->frameName().compare(QString("mainFrame")) == 0)
{
QString str[E_DATA_MAX];
QString strHead[E_DATA_MAX] = {"NickName","ArticleID","ArticleTitle","Date","Data"};
QString strHead[E_DATA_MAX] = {"NickName","ArticleID","ArticleTitle","Date","Data","PlatformTitle"};
/////////////////////////////////////////////
QWebElement proTitle = Find(frame->documentElement(),"td","id","blogTitleText");
QString strTitle = proTitle.toPlainText();
qDebug() << strTitle.trimmed();
//////////////////////////////////////////////
/// \brief profile
///
str[E_DATA_PLATFORM_TITLE] = proTitle.toPlainText().trimmed();
QWebElement profile = Find(frame->documentElement(),"div","id","blog-profile");
{
QWebElement nick = Find(profile,"strong","id","nickNameArea");
@@ -328,8 +326,6 @@ void SCrawler::saveFrameUrl(QWebFrame *frame)
if(str[E_DATA_NICK].isEmpty())
{
//UpdateError("Error code 2");
//return;
QString strHtml = frame->toHtml();
QString strFind = "var nickName = '";
int start = strHtml.indexOf(strFind);
@@ -362,10 +358,8 @@ void SCrawler::saveFrameUrl(QWebFrame *frame)
if (str[E_DATA_ID].isEmpty())
str[E_DATA_ID] = m_strUrl.split("/").at(3);
}
qDebug() << profile.toInnerXml();
QWebElement image = Find(profile,"img","alt","프로필 이미지");
qDebug() << image.toPlainText();
}
//QWebElement image = Find(profile,"img","alt","프로필 이미지");
}
{
QWebElement post = Find(frame->documentElement(),"div","id","postListBody");
@@ -620,11 +614,11 @@ void SCrawler::saveFrameCafeUrl(QWebFrame *frame)
strNick = list.at(0);
strID = Find(Find(frame->documentElement(),"td","class","m-tcol-c b nick"),"a","class","m-tcol-c b").attribute("onclick").trimmed().split(",").at(1).trimmed().replace("'","");
}
qDebug() << "id : " << strID;
//qDebug() << "id : " << strID;
}
strViews = Find(frame->documentElement(),"span","class","b m-tcol-c reply _rosReadcount").toPlainText();
qDebug() << "Count : " << strViews;
//qDebug() << "Count : " << strViews;
//if (strDate.isEmpty() == false)
{
@@ -662,7 +656,7 @@ void SCrawler::saveFrameCafeUrl(QWebFrame *frame)
QString strDate = Find(element,"span","class","date m-tcol-c filter-50").toPlainText().trimmed();
if (strDate.isEmpty()) continue;
QString strID = Find(element,"input","name","writerid").attribute("value").trimmed();
qDebug() << strID;
//qDebug() << strID;
QSqlQuery query;
query.prepare(QString("insert into " + m_strTableReply + " (Url,NickName,Data,Date,UrlReply,RowNum) VALUES (:URL,:NICK,:DATA,:DATE,:URLREPLY,:ROWNUM)").toUtf8());
query.bindValue(":URL",m_strUrl.toUtf8());
@@ -687,7 +681,7 @@ void SCrawler::saveFrameCafeUrl(QWebFrame *frame)
if (eleParent.toPlainText().isEmpty() == false)
strReParent = eleParent.toPlainText();
QString strID = Find(element,"input","name","writerid").attribute("value").trimmed();
qDebug() << strID;
//qDebug() << strID;
QSqlQuery query;
query.prepare(QString("insert into " + m_strTableReply + " (Url,NickName,Data,Date,Parent,UrlReply,RowNum) VALUES (:URL,:NICK,:DATA,:DATE,:PARENT,:URLREPLY,:ROWNUM)").toUtf8());