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
76e4f01b
Commit
76e4f01b
authored
Jan 25, 2021
by
马黎滨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新浪热榜采集更新+微博封面图更新
parent
c06c9268
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/main/java/com/zhiwei/searchhotcrawler/crawler/XinLangHotSearchCrawler.java
+15
-7
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
+3
-0
No files found.
src/main/java/com/zhiwei/searchhotcrawler/crawler/XinLangHotSearchCrawler.java
View file @
76e4f01b
...
...
@@ -58,7 +58,13 @@ public class XinLangHotSearchCrawler {
Integer
rank
=
i
+
1
;
String
hotValue
=
jsonArray
.
getJSONObject
(
i
).
getString
(
"hotValue"
);
Integer
count
=
TipsUtils
.
getHotCount
(
hotValue
);
String
showTags
=
jsonArray
.
getJSONObject
(
i
).
getString
(
"showTags"
);
String
showTags
;
if
(
jsonArray
.
getJSONObject
(
i
).
containsKey
(
"card"
)){
JSONArray
cardArray
=
jsonArray
.
getJSONObject
(
i
).
getJSONArray
(
"card"
);
showTags
=
cardArray
.
getJSONObject
(
0
).
getString
(
"showTags"
);
}
else
{
showTags
=
jsonArray
.
getJSONObject
(
i
).
getString
(
"showTags"
);
}
String
routeUri
=
jsonArray
.
getJSONObject
(
i
).
getString
(
"routeUri"
);
String
xinLangUrl
=
null
;
if
(
routeUri
.
contains
(
"groupId"
))
{
...
...
@@ -68,12 +74,14 @@ public class XinLangHotSearchCrawler {
xinLangUrl
=
"https://m.so.com/s?q="
+
URLCodeUtil
.
getURLEncode
(
name
,
"utf-8"
)+
"&src=dfttrc&srcg=sina_shoulang_act"
;
}
String
icon
=
null
;
if
(
showTags
.
contains
(
"新"
))
{
icon
=
"新"
;
}
else
if
(
showTags
.
contains
(
"热"
))
{
icon
=
"热"
;
}
else
if
(
showTags
.
contains
(
"沸"
))
{
icon
=
"沸"
;
if
(
Objects
.
nonNull
(
showTags
))
{
if
(
showTags
.
contains
(
"新"
))
{
icon
=
"新"
;
}
else
if
(
showTags
.
contains
(
"热"
))
{
icon
=
"热"
;
}
else
if
(
showTags
.
contains
(
"沸"
))
{
icon
=
"沸"
;
}
}
HotSearchList
hotSearchList
=
new
HotSearchList
(
xinLangUrl
,
name
,
count
,
true
,
rank
,
HotSearchType
.
新浪热榜
.
name
(),
icon
,
date
);
hotSearchLists
.
add
(
hotSearchList
);
...
...
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
View file @
76e4f01b
...
...
@@ -329,6 +329,9 @@ public class HotSearchCacheDAO {
nowDoc
.
put
(
"readCount"
,
document
.
getInteger
(
"readCount"
));
nowDoc
.
put
(
"discussCount"
,
document
.
getInteger
(
"discussCount"
));
}
if
(
document
.
containsKey
(
"pictureUrl"
)){
nowDoc
.
put
(
"pictureUrl"
,
document
.
getString
(
"pictureUrl"
));
}
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