네이버 블로그 통계 계산하는 부분 수정
git-svn-id: svn://192.168.0.12/source@309 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-02T11:54:41. -->
|
||||
<!-- Written by QtCreator 4.1.0, 2016-11-04T16:52:12. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
@@ -1061,7 +1061,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" "28" "http://blog.naver.com/nososo1/220702021045"</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments">"naver" "blog" "5" "http://blog.naver.com/nososo1/220702021045"</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>
|
||||
|
||||
@@ -35,7 +35,7 @@ void SEffectProcess::slotOk()
|
||||
void SEffectProcess::slotError(E_ERROR_CODE _error, const QString& _msg)
|
||||
{
|
||||
qDebug() << "slotError";
|
||||
qDebug() << _msg;
|
||||
//qDebug() << _msg;
|
||||
std::cout << 'x' << SEPERATOR.toStdString() << m_pParam[E_PARAM_EVENT_CODE].toStdString()
|
||||
<< SEPERATOR.toStdString() << m_pParam[E_PARAM_URL].toStdString()
|
||||
<< SEPERATOR.toStdString() << EnumErrorCodetostrErrorCode(_error).toStdString()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <QJsonValue>
|
||||
#include <QDebug>
|
||||
|
||||
int getReplyCount(const EffectData& _data)
|
||||
int getInteractionCount(const EffectData& _data)
|
||||
{
|
||||
QSet<QString> set_id;
|
||||
foreach (const DataForm& row, _data.reply)
|
||||
@@ -18,6 +18,11 @@ int getReplyCount(const EffectData& _data)
|
||||
return set_id.size();
|
||||
}
|
||||
|
||||
int getReplyCount(const EffectData &_data)
|
||||
{
|
||||
return _data.reply.size();
|
||||
}
|
||||
|
||||
int getlikeCount(const EffectData& _data)
|
||||
{
|
||||
//qDebug() << "getlikeCount:" << _data.body.data[REPLY_URL];
|
||||
@@ -55,7 +60,7 @@ QString getReplyBuzz(const EffectData& _data)
|
||||
|
||||
foreach (auto &row, _data.reply)
|
||||
{
|
||||
qDebug() << row.data[ARTICLE_DATE].trimmed();
|
||||
// qDebug() << row.data[ARTICLE_DATE].trimmed();
|
||||
QDate date = QDateTime::fromString(row.data[ARTICLE_DATE].trimmed().replace("T", " ").replace(".","-").replace("- "," "), "yyyy-MM-dd hh:mm:ss").date();
|
||||
if (!mapDate.contains(date))
|
||||
//mapDate.insert(date, 0);
|
||||
@@ -68,6 +73,6 @@ QString getReplyBuzz(const EffectData& _data)
|
||||
jObj[iter.key().toString("yyyyMMdd")] = iter.value();
|
||||
}
|
||||
QJsonDocument jDoc(jObj);
|
||||
QString result = jDoc.toJson();
|
||||
QString result = jDoc.toJson(QJsonDocument::Compact);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ int getlikeCount(const EffectData& _data);
|
||||
int getViewCount(const EffectData& _data);
|
||||
|
||||
|
||||
int getInteractionCount(const EffectData& _data);
|
||||
|
||||
|
||||
QString getViewBuzz(const EffectData& _data);
|
||||
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ void SNaverBlog::slotAlert(const QString& msg)
|
||||
|
||||
void SNaverBlog::go(const QString &_url, E_CRAWL_MODE _mode)
|
||||
{
|
||||
qDebug() << _url;
|
||||
//qDebug() << _url;
|
||||
m_eMode = _mode;
|
||||
QUrl url(_url.trimmed());
|
||||
if (_mode == E_CRAWL_MODE::BODY)
|
||||
@@ -549,7 +549,7 @@ QString SNaverBlog::makeReplyUrl(const QString& _url)
|
||||
|
||||
void SNaverBlog::cbBodyArticleDate(const QVariant& _result)
|
||||
{
|
||||
qDebug() << "articledate";
|
||||
//qDebug() << "articledate";
|
||||
bool ok;
|
||||
//static int Retry = 2;
|
||||
QString strDate = _result.toString();
|
||||
@@ -560,14 +560,14 @@ void SNaverBlog::cbBodyArticleDate(const QVariant& _result)
|
||||
strDate = "1990-01-01 00:00:00";
|
||||
m_efData.body.data[ARTICLE_DATE] = strDate;
|
||||
ok = doneBodyCrawler(E_FUNC_ARTICLE_DATE);
|
||||
qDebug() << "done articledate";
|
||||
//qDebug() << "done articledate";
|
||||
if (ok)
|
||||
goReplyUrl();
|
||||
}
|
||||
|
||||
void SNaverBlog::cbBodyArticleData(const QVariant& _result)
|
||||
{
|
||||
qDebug() << "articledata";
|
||||
//qDebug() << "articledata";
|
||||
bool ok;
|
||||
//static int Retry = 2;
|
||||
|
||||
@@ -575,7 +575,7 @@ void SNaverBlog::cbBodyArticleData(const QVariant& _result)
|
||||
strData = GetSafeUtf(strData.trimmed());
|
||||
m_efData.body.data[ARTICLE_DATA] = strData;
|
||||
ok = doneBodyCrawler(E_FUNC_ARTICLE_DATA);
|
||||
qDebug() << "done articledata";
|
||||
//qDebug() << "done articledata";
|
||||
|
||||
if (ok)
|
||||
goReplyUrl();
|
||||
@@ -583,7 +583,7 @@ void SNaverBlog::cbBodyArticleData(const QVariant& _result)
|
||||
|
||||
void SNaverBlog::cbBodyArticleTitle(const QVariant& _result)
|
||||
{
|
||||
qDebug() << "articletitle";
|
||||
//qDebug() << "articletitle";
|
||||
bool ok;
|
||||
//static int Retry = 2;
|
||||
|
||||
@@ -592,7 +592,7 @@ void SNaverBlog::cbBodyArticleTitle(const QVariant& _result)
|
||||
|
||||
m_efData.body.data[ARTICLE_TITLE] = strData;
|
||||
ok = doneBodyCrawler(E_FUNC_ARTICLE_TITLE);
|
||||
qDebug() << "done articletitle";
|
||||
//qDebug() << "done articletitle";
|
||||
|
||||
if (ok)
|
||||
goReplyUrl();
|
||||
@@ -600,7 +600,7 @@ void SNaverBlog::cbBodyArticleTitle(const QVariant& _result)
|
||||
|
||||
void SNaverBlog::cbBodyArticleNickname(const QVariant& _result)
|
||||
{
|
||||
qDebug() << "articlenickname";
|
||||
//qDebug() << "articlenickname";
|
||||
bool ok;
|
||||
//static int Retry = 2;
|
||||
QString strData = _result.toString();
|
||||
@@ -608,14 +608,14 @@ void SNaverBlog::cbBodyArticleNickname(const QVariant& _result)
|
||||
|
||||
m_efData.body.data[ARTICLE_NICKNAME] = strData;
|
||||
ok = doneBodyCrawler(E_FUNC_ARTICLE_NICKNAME);
|
||||
qDebug() << "done articlenickname";
|
||||
//qDebug() << "done articlenickname";
|
||||
if (ok)
|
||||
goReplyUrl();
|
||||
}
|
||||
|
||||
void SNaverBlog::cbBodyArticleOrder(const QVariant& _result)
|
||||
{
|
||||
qDebug() << "articleorder";
|
||||
//qDebug() << "articleorder";
|
||||
bool ok;
|
||||
//static int Retry = 2;
|
||||
QString strData = _result.toString();
|
||||
@@ -623,14 +623,14 @@ void SNaverBlog::cbBodyArticleOrder(const QVariant& _result)
|
||||
strData = strData.replace(QRegExp("[\\D]+"), "");
|
||||
m_efData.body.data[ARTICLE_ORDER] = strData;
|
||||
ok = doneBodyCrawler(E_FUNC_ARTICLE_ORDER);
|
||||
qDebug() << "done articleorder";
|
||||
//qDebug() << "done articleorder";
|
||||
if (ok)
|
||||
goReplyUrl();
|
||||
}
|
||||
|
||||
void SNaverBlog::cbBodyReplyUrl(const QVariant& _result)
|
||||
{
|
||||
qDebug() << "replyurl";
|
||||
//qDebug() << "replyurl";
|
||||
bool ok;
|
||||
static int Retry = 2;
|
||||
QString strData = _result.toString().trimmed().replace(",", "");
|
||||
@@ -643,7 +643,7 @@ void SNaverBlog::cbBodyReplyUrl(const QVariant& _result)
|
||||
}
|
||||
m_efData.body.data[REPLY_URL] = strData;
|
||||
ok = doneBodyCrawler(E_FUNC_REPLY_URL);
|
||||
qDebug() << "done replyurl";
|
||||
//qDebug() << "done replyurl";
|
||||
if (ok)
|
||||
goReplyUrl();
|
||||
}
|
||||
@@ -664,15 +664,16 @@ bool SNaverBlog::doneBodyCrawler(E_FUNC _func_type)
|
||||
|
||||
void SNaverBlog::goReplyUrl()
|
||||
{
|
||||
qDebug() << "goReplyUrl";
|
||||
m_bBodyProcessed = true;
|
||||
|
||||
m_bBodyProcessed = true;
|
||||
/*
|
||||
qDebug() << m_efData.body.data[ARTICLE_TITLE];
|
||||
qDebug() << m_efData.body.data[REPLY_URL];
|
||||
qDebug() << m_efData.body.data[ARTICLE_NICKNAME];
|
||||
qDebug() << m_efData.body.data[ARTICLE_DATE];
|
||||
qDebug() << m_efData.body.data[ARTICLE_DATA];
|
||||
qDebug() << m_efData.body.data[ARTICLE_ORDER];
|
||||
*/
|
||||
if (!check(m_efData.body))
|
||||
{
|
||||
emit signalError(E_ERROR_CODE::BLOCK_ERROR, "Block or Check naver");
|
||||
@@ -706,7 +707,9 @@ void SNaverBlog::cbReply(const QVariant& _result)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
qDebug() << "cbReply";
|
||||
qDebug() << m_efData.reply.size();
|
||||
*/
|
||||
emit signalDataOk(m_efData);
|
||||
}
|
||||
|
||||
@@ -14,18 +14,13 @@ State_s1_effect SNaverBlogProcess::processData(const EffectData& _data)
|
||||
State_s1_effect result;
|
||||
|
||||
result.event_num = eventCode();
|
||||
qDebug() << result.event_num;
|
||||
|
||||
result.likecount = getlikeCount(_data);
|
||||
qDebug() << result.likecount;
|
||||
result.replybuzz = getReplyBuzz(_data);
|
||||
qDebug() << "replybuzz";
|
||||
result.viewcount = getViewCount(_data);
|
||||
qDebug() << result.viewcount;
|
||||
|
||||
result.interactioncount = getInteractionCount(_data);
|
||||
result.replycount = getReplyCount(_data);
|
||||
result.engagementcount = result.likecount + result.replycount;
|
||||
|
||||
qDebug() << result.replycount;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user