effect 수정
git-svn-id: svn://192.168.0.12/source@334 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.1.0, 2016-11-21T16:16:29. -->
|
||||
<!-- Written by QtCreator 4.1.0, 2017-01-06T16:11:47. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
@@ -228,15 +228,18 @@
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">-1</value>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
|
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
|
||||
<value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
|
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">EffectProcess</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/source/EffectProcess/EffectProcess.pro</value>
|
||||
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">EffectProcess.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/source/build-EffectProcess-Desktop_Qt_5_4_0_MSVC2013_32bit-Debug</value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
@@ -430,7 +433,7 @@
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/source/build-EffectProcess-Desktop_Qt_5_4_1_MSVC2013_64bit-Debug</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
@@ -624,7 +627,7 @@
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/source/build-EffectProcess-Desktop_Qt_5_5_1_MSVC2013_64bit3-Debug</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
@@ -1061,7 +1064,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/source/EffectProcess/EffectProcess.pro</value>
|
||||
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments">"naver" "blog" "5" "http://blog.naver.com/nososo1/220702021045"</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments">"naver" "blog" "22" "http://blog.naver.com/27056/220820109447"</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">EffectProcess.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
|
||||
@@ -65,5 +65,3 @@ bool SEffectProcess::send(const State_s1_effect& _result)
|
||||
{
|
||||
return m_pResultSender->send(_result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QJsonArray>
|
||||
#include <QDebug>
|
||||
|
||||
int getInteractionCount(const EffectData& _data)
|
||||
@@ -47,11 +48,12 @@ QString getReplyBuzz(const EffectData& _data)
|
||||
|
||||
QDate firstDate = QDateTime::fromString(_data.body.data[ARTICLE_DATE].trimmed().replace("T", " ").replace(".","-").replace("- "," "), "yyyy-MM-dd hh:mm:ss").date();
|
||||
QDate lastDate = QDate::currentDate();
|
||||
/*
|
||||
|
||||
|
||||
qDebug() << _data.body.data[ARTICLE_DATE];
|
||||
qDebug() << "firstDate:" << firstDate.toString("yyyy-MM-dd");
|
||||
qDebug() << "lastDate:" << lastDate.toString("yyyy-MM-dd");
|
||||
*/
|
||||
|
||||
|
||||
for (QDate date = firstDate; date <= lastDate; date = date.addDays(1))
|
||||
{
|
||||
@@ -67,12 +69,16 @@ QString getReplyBuzz(const EffectData& _data)
|
||||
continue;
|
||||
mapDate[date]++;
|
||||
}
|
||||
QJsonObject jObj;
|
||||
QJsonArray jArray;
|
||||
|
||||
for (auto iter = mapDate.cbegin(); iter != mapDate.cend(); ++iter)
|
||||
{
|
||||
jObj[iter.key().toString("yyyyMMdd")] = iter.value();
|
||||
QJsonObject jObj;
|
||||
jObj["date"] = iter.key().toString("MM-dd-yyyy");
|
||||
jObj["value"] = iter.value();
|
||||
jArray.append(jObj);
|
||||
}
|
||||
QJsonDocument jDoc(jObj);
|
||||
QJsonDocument jDoc(jArray);
|
||||
QString result = jDoc.toJson(QJsonDocument::Compact);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -14,14 +14,14 @@ const int TIME = 3000;//3 second
|
||||
|
||||
using std::placeholders::_1;
|
||||
|
||||
const QString SNaverBlog::
|
||||
scriptArticleDate = "function findArticledate() {"
|
||||
"var tt = frames['mainFrame'].document.querySelector('p.date.fil5.pcol2._postAddDate');"
|
||||
"if(!tt)"
|
||||
" tt = frames['mainFrame'].document.querySelector('span.se_publishDate.pcol2.fil5');"
|
||||
"return tt.textContent;"
|
||||
"}"
|
||||
"findArticledate();";
|
||||
const QString SNaverBlog::scriptArticleDate =
|
||||
"function findArticledate() {"
|
||||
"var tt = frames['mainFrame'].document.querySelector('p.date.fil5.pcol2._postAddDate'); "
|
||||
"if(!tt) "
|
||||
" tt = frames['mainFrame'].document.querySelector('span.se_publishDate.pcol2.fil5'); "
|
||||
"return tt.innerText;"
|
||||
"} "
|
||||
"findArticledate();";
|
||||
|
||||
const QString SNaverBlog::scriptArticleTitle =
|
||||
"function findArticletitle() "
|
||||
@@ -356,6 +356,23 @@ void SNaverBlog::initConnect()
|
||||
m_pWebPage->settings()->setAttribute(QWebEngineSettings::AutoLoadImages, false);
|
||||
}
|
||||
|
||||
QString SNaverBlog::changeUrl(const QString& _url)
|
||||
{
|
||||
QStringList strList = _url.split("/");
|
||||
QString strOut = "";
|
||||
if ((strList.size() > 3) && strList.at(2).contains("blog.me")) //id.blog.me
|
||||
{
|
||||
strOut = "http://blog.naver.com/";
|
||||
strOut += strList.at(2).split(".").at(0);
|
||||
strOut += "/";
|
||||
strOut += strList.at(3);
|
||||
return strOut;
|
||||
}
|
||||
else
|
||||
return _url;
|
||||
}
|
||||
|
||||
|
||||
void SNaverBlog::slotAlert(const QString& msg)
|
||||
{
|
||||
emit signalError(E_ERROR_CODE::DELETED_URL_ERROR, msg.toUtf8());
|
||||
@@ -365,7 +382,8 @@ void SNaverBlog::go(const QString &_url, E_CRAWL_MODE _mode)
|
||||
{
|
||||
//qDebug() << _url;
|
||||
m_eMode = _mode;
|
||||
QUrl url(_url.trimmed());
|
||||
|
||||
QUrl url(changeUrl(_url));
|
||||
if (_mode == E_CRAWL_MODE::BODY)
|
||||
m_strUrl = _url.trimmed();
|
||||
/*
|
||||
@@ -423,6 +441,7 @@ void SNaverBlog::slotLoadFinished(bool ok)
|
||||
qDebug() << "reply loadfinished";
|
||||
|
||||
m_pWebPage->runJavaScript(scriptReply, std::bind(&SNaverBlog::cbReply, this, _1));
|
||||
/*
|
||||
m_pWebPage->toHtml([](const QString &str){
|
||||
|
||||
QFile file("reply.html");
|
||||
@@ -434,6 +453,7 @@ void SNaverBlog::slotLoadFinished(bool ok)
|
||||
file.close();
|
||||
|
||||
});
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -496,7 +516,7 @@ DataForm SNaverBlog::getBody()
|
||||
bool SNaverBlog::check(const DataForm &_data)
|
||||
{
|
||||
if (_data.data[ARTICLE_NICKNAME].isEmpty() &&
|
||||
(_data.data[ARTICLE_DATE] == "1990-01-01 00:00" ||
|
||||
(_data.data[ARTICLE_DATE] == "1990-01-01 00:00:00" ||
|
||||
_data.data[ARTICLE_DATE].isEmpty()))
|
||||
return false;
|
||||
else
|
||||
@@ -512,35 +532,30 @@ QString SNaverBlog::makeReplyUrl(const QString& _url)
|
||||
{
|
||||
QStringList strList = _url.split("/");
|
||||
QString strOut = "";
|
||||
try
|
||||
if((strList.size() > 4) && (strList.at(2).compare("blog.naver.com") == 0))
|
||||
{
|
||||
if(strList.at(2).compare("blog.naver.com") == 0)
|
||||
{
|
||||
//strOut = _strUrl;
|
||||
strOut = "http://blog.naver.com";
|
||||
strOut += "/CommentList.nhn?blogId=";
|
||||
strOut += strList.at(3);
|
||||
strOut += "&logNo=";
|
||||
strOut += strList.at(4);
|
||||
strOut += "¤tPage=&isMemolog=false&focusingCommentNo=&showLastPage=true&shortestContentAreaWidth=false";
|
||||
}
|
||||
else //id.blog.me
|
||||
{
|
||||
strOut = "http://blog.naver.com/";
|
||||
//strOut += strList.at(2).split(".").at(0);
|
||||
//strOut += "/";
|
||||
//strOut += strList.at(3);
|
||||
strOut += "/CommentList.nhn?blogId=";
|
||||
strOut += strList.at(2).split(".").at(0);
|
||||
strOut += "&logNo=";
|
||||
strOut += strList.at(3);
|
||||
strOut += "¤tPage=&isMemolog=false&focusingCommentNo=&showLastPage=true&shortestContentAreaWidth=false";
|
||||
}
|
||||
//strOut = _strUrl;
|
||||
strOut = "http://blog.naver.com";
|
||||
strOut += "/CommentList.nhn?blogId=";
|
||||
strOut += strList.at(3);
|
||||
strOut += "&logNo=";
|
||||
strOut += strList.at(4);
|
||||
strOut += "¤tPage=&isMemolog=false&focusingCommentNo=&showLastPage=true&shortestContentAreaWidth=false";
|
||||
}
|
||||
catch (...)
|
||||
else if ((strList.size() > 3) && strList.at(2).contains("blog.me")) //id.blog.me
|
||||
{
|
||||
emit signalError(E_ERROR_CODE::OUT_DATED_CRAWLER, "Check ReplyUrl\n" + strOut);
|
||||
strOut = "http://blog.naver.com/";
|
||||
//strOut += strList.at(2).split(".").at(0);
|
||||
//strOut += "/";
|
||||
//strOut += strList.at(3);
|
||||
strOut += "/CommentList.nhn?blogId=";
|
||||
strOut += strList.at(2).split(".").at(0);
|
||||
strOut += "&logNo=";
|
||||
strOut += strList.at(3);
|
||||
strOut += "¤tPage=&isMemolog=false&focusingCommentNo=&showLastPage=true&shortestContentAreaWidth=false";
|
||||
}
|
||||
else
|
||||
emit signalError(E_ERROR_CODE::OUT_DATED_CRAWLER, "Check Body and ReplyUrl\n" + strOut);
|
||||
|
||||
return strOut;
|
||||
}
|
||||
@@ -557,6 +572,20 @@ void SNaverBlog::cbBodyArticleDate(const QVariant& _result)
|
||||
strDate += ":00";
|
||||
else
|
||||
strDate = "1990-01-01 00:00:00";
|
||||
|
||||
/*
|
||||
qDebug() << "Body Article Date : " << strDate;
|
||||
|
||||
if (strDate.trimmed().isEmpty() && (Retry-- > 0))
|
||||
{
|
||||
QTimer::singleShot(TIME, this, [this](){
|
||||
this->m_pWebPage->runJavaScript(scriptArticleDate, std::bind(&SNaverBlog::cbBodyArticleDate, this, _1));
|
||||
});
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
m_efData.body.data[ARTICLE_DATE] = strDate;
|
||||
ok = doneBodyCrawler(E_FUNC_ARTICLE_DATE);
|
||||
//qDebug() << "done articledate";
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
|
||||
private:
|
||||
QString makeReplyUrl(const QString& _url);
|
||||
QString changeUrl(const QString& _url);
|
||||
void initConnect();
|
||||
bool check(const DataForm& _data);
|
||||
bool check(const QVector<DataForm>& _data);
|
||||
|
||||
@@ -85,12 +85,12 @@ bool SResultSender::send(const State_s1_effect& _result)
|
||||
|
||||
QString strQuery =
|
||||
"insert into stats_s1_effect ("
|
||||
"event_num,replybuzz,replycount,likecount,interactioncount,engagementcount,lastupdate_filter) "
|
||||
"event_num,replybuzz,replycount,likecount,interactioncount,engagementcount,lastupdate_filter,status) "
|
||||
"values "
|
||||
"(:event_num,:replybuzz,:replycount,:likecount,:interactioncount,:engagementcount,:lastupdate_filter) "
|
||||
"(:event_num,:replybuzz,:replycount,:likecount,:interactioncount,:engagementcount,:lastupdate_filter,'OK') "
|
||||
"on duplicate key update replybuzz = :replybuzz, replycount = :replycount,"
|
||||
"likecount = :likecount, interactioncount = :interactioncount,"
|
||||
"engagementcount = :engagementcount, lastupdate_filter = :lastupdate_filter";
|
||||
"engagementcount = :engagementcount, lastupdate_filter = :lastupdate_filter, status = 'OK'";
|
||||
QSqlQuery query(db);
|
||||
|
||||
query.prepare(strQuery);
|
||||
|
||||
Reference in New Issue
Block a user