Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
toutiao
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
toutiao
Commits
b0b37b1a
Commit
b0b37b1a
authored
Feb 27, 2019
by
yangchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
头条账号列表采集接口修改
parent
cc074bc0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
src/main/java/com/zhiwei/toutiao/parse/TouTiaoAccountParse.java
+7
-2
No files found.
src/main/java/com/zhiwei/toutiao/parse/TouTiaoAccountParse.java
View file @
b0b37b1a
...
...
@@ -103,8 +103,9 @@ public class TouTiaoAccountParse {
boolean
f
=
true
;
int
page
=
0
;
while
(
f
){
String
url
=
"https://www.toutiao.com/
search_content/?offset="
+
page
*
20
+
"&format=json&keyword="
+
URLCodeUtil
.
getURLEncode
(
word
,
"utf-8"
)+
"&autoload=true&count=20&cur_tab=4&from=media
"
;
String
url
=
"https://www.toutiao.com/
api/search/content/?aid=24&app_name=web_search&offset="
+
page
*
20
+
"&format=json&keyword="
+
URLCodeUtil
.
getURLEncode
(
word
,
"utf-8"
)+
"&autoload=true&count=20&en_qc=1&cur_tab=4&from=media&pd=user
"
;
headerMap
=
Tools
.
getTouTiaoHeader
();
System
.
out
.
println
(
url
);
try
{
String
htmlBody
=
downloadHtml
(
url
,
proxy
,
headerMap
);
if
(
htmlBody
!=
null
){
...
...
@@ -358,19 +359,23 @@ public class TouTiaoAccountParse {
JSONObject
data
=
jsonArray
.
getJSONObject
(
i
);
user_id
=
data
.
getLong
(
"id"
);
name
=
data
.
getString
(
"name"
);
if
(
data
.
containsKey
(
"media_id"
))
{
media_id
=
data
.
getLong
(
"media_id"
);
}
description
=
data
.
getString
(
"description"
);
user_verified
=
data
.
getInteger
(
"user_verified"
);
verify_content
=
data
.
getString
(
"verify_content"
);
follow_count
=
data
.
getInteger
(
"follow_count"
);
img_url
=
"https:"
+
data
.
getString
(
"avatar_url"
);
create_time
=
new
Date
(
Integer
.
valueOf
(
data
.
getString
(
"create_time"
)+
"000"
));
create_time
=
new
Date
(
Long
.
parseLong
((
data
.
getString
(
"create_time"
)+
"000"
)
));
gender
=
data
.
getString
(
"gender"
);
user_type
=
data
.
getString
(
"user_type"
);
tta
=
new
TouTiaoAccount
(
user_id
,
name
,
media_id
,
description
,
user_verified
,
verify_content
,
follow_count
,
img_url
,
create_time
,
gender
,
user_type
);
if
(
Objects
.
nonNull
(
proxy
))
{
ZhiWeiTools
.
sleep
(
1000
);
}
TouTiaoAccount
ttaUpdate
=
getTouTiaoAccountInfoByUserId
(
user_id
+
""
,
proxy
);
if
(
ttaUpdate
!=
null
){
tta
.
setFriend_count
(
ttaUpdate
.
getFriend_count
());
...
...
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