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
fd08d8f7
Commit
fd08d8f7
authored
Sep 02, 2021
by
chenweitao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'working' into 'master'
list表新增微博iconUrl字段 修复weibo_user粉丝量采集异常情况 See merge request
!124
parents
12c815c2
ab081ccd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
src/main/java/com/zhiwei/searchhotcrawler/bean/HotSearchList.java
+5
-0
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
+12
-5
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
+3
-0
No files found.
src/main/java/com/zhiwei/searchhotcrawler/bean/HotSearchList.java
View file @
fd08d8f7
...
...
@@ -75,6 +75,11 @@ public class HotSearchList implements Serializable{
private
String
icon
;
/**
* icon地址
*/
private
String
iconUrl
;
/**
* 话题讨论量或阅读量
*/
private
Long
commentCount
;
...
...
src/main/java/com/zhiwei/searchhotcrawler/crawler/WeiboHotSearchCrawler.java
View file @
fd08d8f7
...
...
@@ -166,13 +166,15 @@ public class WeiboHotSearchCrawler {
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 = "http://s.weibo.com/weibo/" + URLCodeUtil.getURLEncode(name, "utf-8") + "&Refer=top";
String
id
=
cardInfo
.
getString
(
"scheme"
);
HotSearchList
hotSearch
=
new
HotSearchList
(
id
,
name
,
hotCount
,
hot
,
rank
,
HotSearchType
.
微博热搜
.
name
(),
icon
,
date
);
if
(
Objects
.
nonNull
(
iconUrl
)){
hotSearch
.
setIconUrl
(
iconUrl
);}
result
.
add
(
hotSearch
);
rank
++;
redisDao
.
addDataToSet
(
RedisConfig
.
WEIBO_HOTSEARCHIDS
,
name
+
"_微博热搜"
);
...
...
@@ -513,8 +515,13 @@ public class WeiboHotSearchCrawler {
Long
followerCount
=
null
;
if
(
followers_count
.
contains
(
"万"
))
{
String
[]
split
=
followers_count
.
split
(
"万"
);
followerCount
=
Long
.
valueOf
(
split
[
0
])
*
10000
;
}
else
{
Double
aDouble
=
Double
.
valueOf
(
split
[
0
])*
10000
;
followerCount
=
new
Double
(
aDouble
).
longValue
();
}
else
if
(
followers_count
.
contains
(
"亿"
)){
String
[]
split
=
followers_count
.
split
(
"亿"
);
Double
aDouble
=
Double
.
valueOf
(
split
[
0
])*
100000000
;
followerCount
=
new
Double
(
aDouble
).
longValue
();
}
else
{
followerCount
=
Long
.
valueOf
(
followers_count
);
}
//用户头像地址
...
...
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
View file @
fd08d8f7
...
...
@@ -50,6 +50,9 @@ public class HotSearchCacheDAO {
document
.
put
(
"topic_lead"
,
hotSearch
.
getTopicLead
());
document
.
put
(
"comment_count"
,
hotSearch
.
getCommentCount
());
}
if
(
"微博热搜"
.
equals
(
hotSearch
.
getType
())){
document
.
put
(
"iconUrl"
,
hotSearch
.
getIconUrl
());
}
// if("今日头条热搜".equals(hotSearch.getType())){
// document.put("comment_count", hotSearch.getCommentCount());
// }
...
...
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