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
53e3fcd8
Commit
53e3fcd8
authored
Oct 22, 2021
by
chenweitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改脉脉采集id上限
parent
fcee33bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
src/main/java/com/zhiwei/searchhotcrawler/crawler/MaiMaiHotSearchCrawler.java
+7
-5
No files found.
src/main/java/com/zhiwei/searchhotcrawler/crawler/MaiMaiHotSearchCrawler.java
View file @
53e3fcd8
...
...
@@ -14,6 +14,7 @@ import okhttp3.Response;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -37,6 +38,8 @@ public class MaiMaiHotSearchCrawler {
}
catch
(
IOException
e
)
{
log
.
error
(
"脉脉热榜页面连接异常..."
,
e
);
}
//1024 - 26(时间戳+type) = 998 -> name.getBytes(StandardCharsets.UTF_8).length<998 -> 998/3 = 332
int
nameLengthMax
=
332
;
if
(
StringUtils
.
isNotBlank
(
htmlBody
)
&&
htmlBody
.
contains
(
"feeds"
))
{
JSONArray
jsonArray
=
JSONObject
.
parseObject
(
htmlBody
).
getJSONArray
(
"feeds"
);
if
(
jsonArray
!=
null
)
{
...
...
@@ -45,8 +48,10 @@ public class MaiMaiHotSearchCrawler {
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
).
getJSONObject
(
"style35"
);
if
(
jsonObject
!=
null
)
{
String
name
=
jsonObject
.
getString
(
"text"
);
if
(
name
.
length
()>
750
){
name
=
name
.
substring
(
0
,
750
);
// 1024 - 26(时间戳+type)
// name.getBytes(StandardCharsets.UTF_8).length<998)
if
(
name
.
length
()>
nameLengthMax
){
name
=
name
.
substring
(
0
,
nameLengthMax
);
}
String
maimaiUrl
=
jsonObject
.
getString
(
"share_url"
);
String
icon
=
null
;
...
...
@@ -56,9 +61,6 @@ public class MaiMaiHotSearchCrawler {
String
hotValue
=
jsonArray
.
getJSONObject
(
i
).
getJSONObject
(
"common"
).
getString
(
"hot_info"
);
Long
count
=
hotValue
.
length
()
>
0
?
TipsUtils
.
getHotCount
(
hotValue
)
:
0
;
HotSearchList
hotSearchList
=
new
HotSearchList
(
maimaiUrl
,
name
,
count
,
null
,
rank
,
HotSearchType
.
脉脉热榜
.
name
(),
icon
,
date
);
if
(
hotSearchList
.
getName
().
length
()>
800
){
log
.
info
(
"脉脉数据名称过长,长度为:{},内容:{}"
,
hotSearchList
.
getName
().
length
(),
hotSearchList
.
getName
());
}
list
.
add
(
hotSearchList
);
}
}
...
...
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