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
f79d4a25
Commit
f79d4a25
authored
Sep 02, 2021
by
chenweitao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'working' into 'master'
新增list表微博娱乐榜iconUrl字段 See merge request
!127
parents
fb902f72
71498213
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboEntertainmentCrawler.java
+5
-3
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
+3
-0
src/main/java/com/zhiwei/searchhotcrawler/test/WeiboEntertainmentCrawlerTest.java
+5
-3
No files found.
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboEntertainmentCrawler.java
View file @
f79d4a25
...
...
@@ -57,14 +57,16 @@ public class WeiboEntertainmentCrawler {
JSONObject
cardInfo
=
cardGroup
.
getJSONObject
(
j
);
String
name
=
cardInfo
.
getString
(
"desc"
);
long
hotCount
=
cardInfo
.
getLongValue
(
"desc_extr"
);
String
icon
=
cardInfo
.
getString
(
"icon"
);
if
(
StringUtils
.
isNotBlank
(
icon
))
{
icon
=
icon
.
split
(
"_"
)[
1
].
split
(
".png"
)[
0
];
String
iconUrl
=
cardInfo
.
getString
(
"icon"
);
String
icon
=
null
;
if
(
StringUtils
.
isNotBlank
(
iconUrl
))
{
icon
=
iconUrl
.
split
(
"_"
)[
1
].
split
(
".png"
)[
0
];
}
String
id
=
cardInfo
.
getString
(
"scheme"
);
String
ul
=
"https://m.weibo.cn/search?"
+
id
.
split
(
"[?]"
)[
1
];
rank
++;
HotSearchList
hotSearch
=
new
HotSearchList
(
ul
,
name
,
hotCount
,
hot
,
rank
,
HotSearchType
.
微博娱乐榜
.
name
(),
icon
,
date
);
if
(
Objects
.
nonNull
(
iconUrl
)){
hotSearch
.
setIconUrl
(
iconUrl
);}
if
(!
"娱乐动态数据详情"
.
equals
(
hotSearch
.
getName
())){
result
.
add
(
hotSearch
);
}
...
...
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
View file @
f79d4a25
...
...
@@ -53,6 +53,9 @@ public class HotSearchCacheDAO {
if
(
"微博热搜"
.
equals
(
hotSearch
.
getType
())){
document
.
put
(
"iconUrl"
,
hotSearch
.
getIconUrl
());
}
if
(
"微博娱乐榜"
.
equals
(
hotSearch
.
getType
())){
document
.
put
(
"iconUrl"
,
hotSearch
.
getIconUrl
());
}
// if("今日头条热搜".equals(hotSearch.getType())){
// document.put("comment_count", hotSearch.getCommentCount());
// }
...
...
src/main/java/com/zhiwei/searchhotcrawler/test/WeiboEntertainmentCrawlerTest.java
View file @
f79d4a25
...
...
@@ -57,14 +57,16 @@ public class WeiboEntertainmentCrawlerTest {
JSONObject
cardInfo
=
cardGroup
.
getJSONObject
(
j
);
String
name
=
cardInfo
.
getString
(
"desc"
);
long
hotCount
=
cardInfo
.
getLongValue
(
"desc_extr"
);
String
icon
=
cardInfo
.
getString
(
"icon"
);
if
(
StringUtils
.
isNotBlank
(
icon
))
{
icon
=
icon
.
split
(
"_"
)[
1
].
split
(
".png"
)[
0
];
String
iconUrl
=
cardInfo
.
getString
(
"icon"
);
String
icon
=
null
;
if
(
StringUtils
.
isNotBlank
(
iconUrl
))
{
icon
=
iconUrl
.
split
(
"_"
)[
1
].
split
(
".png"
)[
0
];
}
String
id
=
cardInfo
.
getString
(
"scheme"
);
String
ul
=
"https://m.weibo.cn/search?"
+
id
.
split
(
"[?]"
)[
1
];
rank
++;
HotSearchList
hotSearch
=
new
HotSearchList
(
ul
,
name
,
hotCount
,
hot
,
rank
,
HotSearchType
.
微博娱乐榜
.
name
(),
icon
,
date
);
if
(
Objects
.
nonNull
(
iconUrl
)){
hotSearch
.
setIconUrl
(
iconUrl
);}
if
(!
"娱乐动态数据详情"
.
equals
(
hotSearch
.
getName
())){
result
.
add
(
hotSearch
);
}
...
...
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