Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
searchhotcrawler
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhiwei
searchhotcrawler
Commits
fcee33bb
Commit
fcee33bb
authored
Oct 22, 2021
by
chenweitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加脉脉采集名称长度日志
parent
630ed695
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
src/main/java/com/zhiwei/searchhotcrawler/crawler/MaiMaiHotSearchCrawler.java
+3
-1
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
+5
-2
No files found.
src/main/java/com/zhiwei/searchhotcrawler/crawler/MaiMaiHotSearchCrawler.java
View file @
fcee33bb
...
@@ -48,7 +48,6 @@ public class MaiMaiHotSearchCrawler {
...
@@ -48,7 +48,6 @@ public class MaiMaiHotSearchCrawler {
if
(
name
.
length
()>
750
){
if
(
name
.
length
()>
750
){
name
=
name
.
substring
(
0
,
750
);
name
=
name
.
substring
(
0
,
750
);
}
}
// log.info(name);
String
maimaiUrl
=
jsonObject
.
getString
(
"share_url"
);
String
maimaiUrl
=
jsonObject
.
getString
(
"share_url"
);
String
icon
=
null
;
String
icon
=
null
;
if
(
jsonObject
.
containsKey
(
"hot_type_card"
))
{
if
(
jsonObject
.
containsKey
(
"hot_type_card"
))
{
...
@@ -57,6 +56,9 @@ public class MaiMaiHotSearchCrawler {
...
@@ -57,6 +56,9 @@ public class MaiMaiHotSearchCrawler {
String
hotValue
=
jsonArray
.
getJSONObject
(
i
).
getJSONObject
(
"common"
).
getString
(
"hot_info"
);
String
hotValue
=
jsonArray
.
getJSONObject
(
i
).
getJSONObject
(
"common"
).
getString
(
"hot_info"
);
Long
count
=
hotValue
.
length
()
>
0
?
TipsUtils
.
getHotCount
(
hotValue
)
:
0
;
Long
count
=
hotValue
.
length
()
>
0
?
TipsUtils
.
getHotCount
(
hotValue
)
:
0
;
HotSearchList
hotSearchList
=
new
HotSearchList
(
maimaiUrl
,
name
,
count
,
null
,
rank
,
HotSearchType
.
脉脉热榜
.
name
(),
icon
,
date
);
HotSearchList
hotSearchList
=
new
HotSearchList
(
maimaiUrl
,
name
,
count
,
null
,
rank
,
HotSearchType
.
脉脉热榜
.
name
(),
icon
,
date
);
if
(
hotSearchList
.
getName
().
length
()>
800
){
log
.
info
(
"脉脉数据名称过长,长度为:{},内容:{}"
,
hotSearchList
.
getName
().
length
(),
hotSearchList
.
getName
());
}
list
.
add
(
hotSearchList
);
list
.
add
(
hotSearchList
);
}
}
}
}
...
...
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
View file @
fcee33bb
package
com
.
zhiwei
.
searchhotcrawler
.
dao
;
package
com
.
zhiwei
.
searchhotcrawler
.
dao
;
import
com.mongodb.MongoWriteException
;
import
com.mongodb.client.MongoCollection
;
import
com.mongodb.client.MongoCollection
;
import
com.zhiwei.searchhotcrawler.bean.HotSearchList
;
import
com.zhiwei.searchhotcrawler.bean.HotSearchList
;
import
com.zhiwei.searchhotcrawler.config.DBConfig
;
import
com.zhiwei.searchhotcrawler.config.DBConfig
;
...
@@ -283,8 +284,10 @@ public class HotSearchCacheDAO {
...
@@ -283,8 +284,10 @@ public class HotSearchCacheDAO {
collection
.
insertOne
(
nowDoc
);
collection
.
insertOne
(
nowDoc
);
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
MongoWriteException
e1
){
log
.
error
(
"数据存储时出错:"
,
e
);
log
.
error
(
"数据写入时出错,数据为【{}】:"
,
document
,
e1
);
}
catch
(
Exception
e
)
{
log
.
error
(
"数据存储时出错,数据为【{}】:"
,
document
,
e
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment