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
b59879ef
Commit
b59879ef
authored
Jul 12, 2021
by
leiliangliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增微博话题采集话题贡献者,关于功能
parent
96ffc323
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
2 deletions
+30
-2
src/main/java/com/zhiwei/searchhotcrawler/bean/WeiBoUser.java
+11
-2
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
+0
-0
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
+11
-0
src/main/java/com/zhiwei/searchhotcrawler/dao/WeiBoUserDao.java
+8
-0
No files found.
src/main/java/com/zhiwei/searchhotcrawler/bean/WeiBoUser.java
View file @
b59879ef
...
...
@@ -53,9 +53,13 @@ public class WeiBoUser implements Serializable {
* 头像地址
*/
private
String
profileImageUrl
;
/**
* 类型
*/
private
String
type
;
public
WeiBoUser
()
{
}
public
WeiBoUser
(
String
userId
,
String
attestationMassage
,
String
userName
,
String
topic
,
Date
time
,
Long
followerCount
,
String
profileImageUrl
)
{
this
.
id
=
userId
+
"_"
+
HotSearchType
.
微博热搜
.
name
()+
"_"
+
topic
;
...
...
@@ -66,6 +70,11 @@ public class WeiBoUser implements Serializable {
this
.
time
=
time
;
this
.
followerCount
=
followerCount
;
this
.
profileImageUrl
=
profileImageUrl
;
}
public
WeiBoUser
(
String
userId
,
String
userName
,
String
topic
,
Date
time
)
{
this
.
userId
=
userId
;
this
.
userName
=
userName
;
this
.
topic
=
topic
;
this
.
time
=
time
;
}
}
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
View file @
b59879ef
This diff is collapsed.
Click to expand it.
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
View file @
b59879ef
...
...
@@ -208,6 +208,17 @@ public class HotSearchCacheDAO {
}
if
(
"微博热搜"
.
equals
(
type
)){
nowDoc
=
WeiboHotSearchCrawler
.
weiboUpdate
(
nowDoc
);
//更新微博话题贡献者,关于功能
Document
documentPC
=
WeiboHotSearchCrawler
.
weiboUpdatePC
(
nowDoc
);
if
(
documentPC
.
containsKey
(
"分类"
))
{
nowDoc
.
put
(
"classify"
,
documentPC
.
get
(
"分类"
));
}
if
(
documentPC
.
containsKey
(
"地区"
))
{
nowDoc
.
put
(
"region"
,
documentPC
.
get
(
"地区"
));
}
if
(
documentPC
.
containsKey
(
"标签"
))
{
nowDoc
.
put
(
"label"
,
documentPC
.
get
(
"标签"
));
}
if
(
nowDoc
.
containsKey
(
"topicLead"
)){
nowDoc
.
put
(
"topicLead"
,
nowDoc
.
getString
(
"topicLead"
));
}
...
...
src/main/java/com/zhiwei/searchhotcrawler/dao/WeiBoUserDao.java
View file @
b59879ef
...
...
@@ -32,6 +32,7 @@ public class WeiBoUserDao {
* @param weiBoUser
*/
public
void
addWeiBoUser
(
WeiBoUser
weiBoUser
){
try
{
Document
document
=
new
Document
();
document
.
put
(
"_id"
,
weiBoUser
.
getId
());
...
...
@@ -42,8 +43,15 @@ public class WeiBoUserDao {
document
.
put
(
"userName"
,
weiBoUser
.
getUserName
());
document
.
put
(
"topic"
,
weiBoUser
.
getTopic
());
document
.
put
(
"time"
,
weiBoUser
.
getTime
());
if
(
Objects
.
nonNull
(
weiBoUser
.
getType
())){
document
.
put
(
"type"
,
weiBoUser
.
getType
());
}
if
(
Objects
.
nonNull
(
weiBoUser
.
getFollowerCount
())){
document
.
put
(
"followerCount"
,
weiBoUser
.
getFollowerCount
());
}
if
(
Objects
.
nonNull
(
weiBoUser
.
getProfileImageUrl
())){
document
.
put
(
"profileImageUrl"
,
weiBoUser
.
getProfileImageUrl
());
}
try
{
mongoCollection
.
insertOne
(
document
);
}
catch
(
Exception
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