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
e5fa93cf
Commit
e5fa93cf
authored
Dec 19, 2019
by
cwy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户端采集修改为 外部控制翻页
parent
b60d852a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
src/main/java/com/zhiwei/toutiao/parse/TouTiaoArticleParse.java
+5
-12
No files found.
src/main/java/com/zhiwei/toutiao/parse/TouTiaoArticleParse.java
View file @
e5fa93cf
...
...
@@ -423,13 +423,11 @@ public class TouTiaoArticleParse {
* @param maxBehotTime
* @return
*/
public
static
List
<
Map
<
String
,
Object
>
>
getClientMicroToutiaoCrawler
(
String
userId
,
ProxyHolder
proxy
,
public
static
Map
<
String
,
Object
>
getClientMicroToutiaoCrawler
(
String
userId
,
ProxyHolder
proxy
,
Long
maxBehotTime
)
{
Map
<
String
,
Object
>
rMap
=
new
HashMap
<>();
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
String
ma
=
""
;
while
(
true
)
{
String
url
=
"https://profile.zjurl.cn/api/feed/profile/v1/?category=profile_all&visited_uid="
+
userId
+
"&stream_api_version=82&offset="
+
maxBehotTime
+
"&version_code=7.5.3&version_name=70503&user_id="
+
userId
+
"&request_source=1&active_tab=dongtai&device_id=65&app_name=news_article"
;
ma
=
String
.
valueOf
(
maxBehotTime
);
try
(
Response
response
=
httpBoot
.
syncCall
(
RequestUtils
.
wrapGet
(
url
),
proxy
)){
String
result
=
response
.
body
().
string
();
JSONObject
json
=
JSONObject
.
parseObject
(
result
);
...
...
@@ -472,7 +470,6 @@ public class TouTiaoArticleParse {
map
.
put
(
"readNum"
,
readNum
);
map
.
put
(
"commentNum"
,
commentNum
);
map
.
put
(
"user_id"
,
userId
);
System
.
out
.
println
(
map
.
toString
());
dataList
.
add
(
map
);
}
}
...
...
@@ -480,16 +477,12 @@ public class TouTiaoArticleParse {
e
.
printStackTrace
();
}
}
System
.
out
.
println
(
" 采集到 条 == "
+
dataList
.
size
()
+
" -- "
+
ma
+
" -- "
+
maxBehotTime
);
if
(
ma
.
equals
(
String
.
valueOf
(
maxBehotTime
)))
{
break
;
}
rMap
.
put
(
"data"
,
dataList
);
rMap
.
put
(
"maxBehotTime"
,
maxBehotTime
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"客户端微头条采集错误 {}"
,
e
);
}
}
return
dataList
;
return
rMap
;
}
/**
...
...
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