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
88c7942a
Commit
88c7942a
authored
Aug 26, 2020
by
chenweitao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mlbWork' into 'master'
今日头条链接 See merge request
!39
parents
7075b291
a98a48ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
src/main/java/com/zhiwei/searchhotcrawler/crawler/ToutiaoHotSearchCrawler.java
+3
-5
No files found.
src/main/java/com/zhiwei/searchhotcrawler/crawler/ToutiaoHotSearchCrawler.java
View file @
88c7942a
...
...
@@ -52,11 +52,8 @@ public class ToutiaoHotSearchCrawler {
}
//采集头条内容
String
url
=
"https://i.snssdk.com/hot-event/hot-board/?origin="
+
origin
;
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
headerMap
.
put
(
"User-Agent"
,
"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"
);
headerMap
.
put
(
"referer"
,
"https://ib.snssdk.com/rogue/aladdin_landingpage/template/aladdin_landingpage/hot_words.html?isBrowser=true&traffic_source="
);
String
htmlBody
=
null
;
Request
request
=
RequestUtils
.
wrapGet
(
url
,
headerMap
);
Request
request
=
RequestUtils
.
wrapGet
(
url
);
for
(
int
count
=
0
;
count
<=
5
;
count
++){
try
(
Response
response
=
httpBoot
.
syncCall
(
request
))
{
htmlBody
=
response
.
body
().
string
();
...
...
@@ -72,7 +69,8 @@ public class ToutiaoHotSearchCrawler {
try
{
JSONObject
word
=
words
.
getJSONObject
(
i
);
String
name
=
word
.
getString
(
"Title"
);
String
link
=
"https://ib.snssdk.com/search/?keyword="
+
URLCodeUtil
.
getURLEncode
(
name
,
"utf-8"
)
+
"&pd=synthesis&source=trending_list&traffic_source="
;
// String link = "https://ib.snssdk.com/search/?keyword=" + URLCodeUtil.getURLEncode(name, "utf-8") + "&pd=synthesis&source=trending_list&traffic_source=";
String
link
=
word
.
getString
(
"Url"
);
Integer
hotCount
=
word
.
getInteger
(
"HotValue"
);
String
wordsType
=
word
.
getString
(
"Label"
);
String
icon
=
getIcon
(
wordsType
);
...
...
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