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
15038a17
Commit
15038a17
authored
Dec 01, 2021
by
chenweitao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'working' into 'master'
新增网易热榜主持人字段 See merge request
!156
parents
830fa0b7
f51d3ad0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
src/main/java/com/zhiwei/searchhotcrawler/crawler/WangYiHotSearchCrawler.java
+2
-0
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
+9
-0
No files found.
src/main/java/com/zhiwei/searchhotcrawler/crawler/WangYiHotSearchCrawler.java
View file @
15038a17
...
@@ -51,10 +51,12 @@ public class WangYiHotSearchCrawler {
...
@@ -51,10 +51,12 @@ public class WangYiHotSearchCrawler {
for
(
int
i
=
0
;
i
<
jsonObject
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
jsonObject
.
size
();
i
++)
{
int
rank
=
i
+
1
;
int
rank
=
i
+
1
;
String
name
=
jsonObject
.
getJSONObject
(
i
).
getString
(
"title"
);
String
name
=
jsonObject
.
getJSONObject
(
i
).
getString
(
"title"
);
String
source
=
jsonObject
.
getJSONObject
(
i
).
getString
(
"source"
);
long
count
=
jsonObject
.
getJSONObject
(
i
).
getLongValue
(
"hotValue"
);
long
count
=
jsonObject
.
getJSONObject
(
i
).
getLongValue
(
"hotValue"
);
String
contentId
=
jsonObject
.
getJSONObject
(
i
).
getString
(
"contentId"
);
String
contentId
=
jsonObject
.
getJSONObject
(
i
).
getString
(
"contentId"
);
String
wangyiUrl
=
"https://c.m.163.com/news/a/"
+
contentId
+
".html"
;
String
wangyiUrl
=
"https://c.m.163.com/news/a/"
+
contentId
+
".html"
;
HotSearchList
hotSearchList
=
new
HotSearchList
(
wangyiUrl
,
name
,
count
,
rank
,
HotSearchType
.
网易热榜
.
name
(),
date
);
HotSearchList
hotSearchList
=
new
HotSearchList
(
wangyiUrl
,
name
,
count
,
rank
,
HotSearchType
.
网易热榜
.
name
(),
date
);
hotSearchList
.
setDowntext
(
source
);
hotSearchLists
.
add
(
hotSearchList
);
hotSearchLists
.
add
(
hotSearchList
);
}
}
log
.
info
(
"{}, 此轮网易新闻热榜采集到的数据量为:{}"
,
new
Date
(),
Integer
.
valueOf
(
hotSearchLists
!=
null
?
hotSearchLists
.
size
()
:
0
));
log
.
info
(
"{}, 此轮网易新闻热榜采集到的数据量为:{}"
,
new
Date
(),
Integer
.
valueOf
(
hotSearchLists
!=
null
?
hotSearchLists
.
size
()
:
0
));
...
...
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
View file @
15038a17
...
@@ -81,6 +81,9 @@ public class HotSearchCacheDAO {
...
@@ -81,6 +81,9 @@ public class HotSearchCacheDAO {
document
.
put
(
"iconUrl"
,
hotSearch
.
getIconUrl
());
document
.
put
(
"iconUrl"
,
hotSearch
.
getIconUrl
());
document
.
put
(
"downtext"
,
hotSearch
.
getDowntext
());
document
.
put
(
"downtext"
,
hotSearch
.
getDowntext
());
}
}
if
(
"网易热榜"
.
equals
(
hotSearch
.
getType
()))
{
document
.
put
(
"downtext"
,
hotSearch
.
getDowntext
());
}
if
(
"百度热搜"
.
equals
(
hotSearch
.
getType
()))
{
if
(
"百度热搜"
.
equals
(
hotSearch
.
getType
()))
{
document
.
put
(
"topic_lead"
,
hotSearch
.
getTopicLead
());
document
.
put
(
"topic_lead"
,
hotSearch
.
getTopicLead
());
}
}
...
@@ -101,6 +104,9 @@ public class HotSearchCacheDAO {
...
@@ -101,6 +104,9 @@ public class HotSearchCacheDAO {
if
(
"微博要闻榜"
.
equals
(
hotSearch
.
getType
()))
{
if
(
"微博要闻榜"
.
equals
(
hotSearch
.
getType
()))
{
document
.
remove
(
"downtext"
);
document
.
remove
(
"downtext"
);
}
}
if
(
"网易热榜"
.
equals
(
hotSearch
.
getType
()))
{
document
.
remove
(
"downtext"
);
}
dataes
.
add
(
document
);
dataes
.
add
(
document
);
}
}
return
dataes
;
return
dataes
;
...
@@ -254,6 +260,9 @@ public class HotSearchCacheDAO {
...
@@ -254,6 +260,9 @@ public class HotSearchCacheDAO {
nowDoc
.
put
(
"downtext"
,
document
.
getString
(
"downtext"
));
nowDoc
.
put
(
"downtext"
,
document
.
getString
(
"downtext"
));
nowDoc
.
put
(
"comment_count"
,
document
.
getLong
(
"comment_count"
));
nowDoc
.
put
(
"comment_count"
,
document
.
getLong
(
"comment_count"
));
}
}
if
(
"网易热榜"
.
equals
(
type
))
{
nowDoc
.
put
(
"downtext"
,
document
.
getString
(
"downtext"
));
}
if
(
topicResult
!=
null
)
{
if
(
topicResult
!=
null
)
{
nowDoc
.
put
(
"topicResult"
,
topicResult
);
nowDoc
.
put
(
"topicResult"
,
topicResult
);
}
}
...
...
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