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
ead257cb
Commit
ead257cb
authored
Apr 02, 2021
by
马黎滨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主持人采集
parent
8b9f767a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
src/main/java/com/zhiwei/searchhotcrawler/bean/HotSearchCache.java
+5
-0
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
+6
-0
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
+6
-0
No files found.
src/main/java/com/zhiwei/searchhotcrawler/bean/HotSearchCache.java
View file @
ead257cb
...
...
@@ -108,6 +108,11 @@ public class HotSearchCache {
*/
private
double
riseSpeed
;
/**
* 主持人
*/
private
String
downtext
;
public
HotSearchCache
(
String
url
,
String
name
,
String
topicLead
,
Integer
highestCount
,
Integer
lastCount
,
Boolean
hot
,
Date
startTime
,
Date
endTime
,
Integer
highestRank
,
Integer
lastRank
,
String
type
,
Integer
duration
){
this
.
id
=
name
+
"_"
+
type
;
...
...
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
View file @
ead257cb
...
...
@@ -258,6 +258,12 @@ public class WeiboHotSearchCrawler {
document
.
put
(
"readCount"
,
TipsUtils
.
getHotCount
(
read
));
document
.
put
(
"discussCount"
,
TipsUtils
.
getHotCount
(
discussCount
));
document
.
put
(
"pictureUrl"
,
pictureUrl
);
if
(
readJson
.
getJSONObject
(
"head_data"
).
containsKey
(
"downtext"
)){
String
downtext
=
readJson
.
getJSONObject
(
"head_data"
).
getString
(
"downtext"
);
if
(!
""
.
equals
(
downtext
))
{
document
.
put
(
"downtext"
,
downtext
.
replaceAll
(
"主持人:"
,
""
));
}
}
}
}
return
document
;
...
...
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
View file @
ead257cb
...
...
@@ -197,6 +197,9 @@ public class HotSearchCacheDAO {
if
(
nowDoc
.
containsKey
(
"pictureUrl"
))
{
nowDoc
.
put
(
"pictureUrl"
,
nowDoc
.
getString
(
"pictureUrl"
));
}
if
(
nowDoc
.
containsKey
(
"downtext"
))
{
nowDoc
.
put
(
"downtext"
,
nowDoc
.
getString
(
"downtext"
));
}
}
collection
.
insertOne
(
nowDoc
);
}
...
...
@@ -342,6 +345,9 @@ public class HotSearchCacheDAO {
if
(
document
.
containsKey
(
"pictureUrl"
)){
nowDoc
.
put
(
"pictureUrl"
,
document
.
getString
(
"pictureUrl"
));
}
if
(
Objects
.
isNull
(
nowDoc
.
get
(
"downtext"
))
&&
document
.
containsKey
(
"downtext"
)){
nowDoc
.
put
(
"downtext"
,
document
.
getString
(
"downtext"
));
}
collection
.
replaceOne
(
query
,
nowDoc
);
}
}
...
...
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