Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
articlenewscrawler
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
chenweiyang
articlenewscrawler
Commits
31b11eff
Commit
31b11eff
authored
Jul 29, 2019
by
win 10
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复用户不存在时的问题
parent
e30d8b32
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
src/main/java/com/zhiwei/parse/XinLangCaiJing.java
+5
-1
No files found.
src/main/java/com/zhiwei/parse/XinLangCaiJing.java
View file @
31b11eff
...
@@ -37,6 +37,8 @@ public class XinLangCaiJing {
...
@@ -37,6 +37,8 @@ public class XinLangCaiJing {
try
(
Response
response
=
httpBoot
.
syncCall
(
RequestUtils
.
wrapGet
(
jsonUrl
),
proxy
))
{
try
(
Response
response
=
httpBoot
.
syncCall
(
RequestUtils
.
wrapGet
(
jsonUrl
),
proxy
))
{
String
htmlBody
=
response
.
body
().
string
();
String
htmlBody
=
response
.
body
().
string
();
JSONObject
json
=
JSONObject
.
parseObject
(
htmlBody
);
JSONObject
json
=
JSONObject
.
parseObject
(
htmlBody
);
if
(!
json
.
getJSONObject
(
"result"
).
getJSONObject
(
"data"
).
toString
().
contains
(
"用户不存在"
))
{
JSONArray
jsonArray
=
json
.
getJSONObject
(
"result"
).
getJSONObject
(
"data"
).
getJSONArray
(
"lists"
);
JSONArray
jsonArray
=
json
.
getJSONObject
(
"result"
).
getJSONObject
(
"data"
).
getJSONArray
(
"lists"
);
int
totalpage
=
json
.
getJSONObject
(
"result"
).
getJSONObject
(
"data"
).
getInteger
(
"totalpage"
);
//总页数
int
totalpage
=
json
.
getJSONObject
(
"result"
).
getJSONObject
(
"data"
).
getInteger
(
"totalpage"
);
//总页数
...
@@ -71,13 +73,15 @@ public class XinLangCaiJing {
...
@@ -71,13 +73,15 @@ public class XinLangCaiJing {
dataList
.
add
(
dataMap
);
dataList
.
add
(
dataMap
);
}
}
}
}
if
(
page
<
totalpage
)
{
if
(
page
<
totalpage
)
{
nextPage
=
true
;
nextPage
=
true
;
page
++;
page
++;
}
else
{
}
else
{
nextPage
=
false
;
nextPage
=
false
;
}
}
}
else
{
nextPage
=
false
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取新浪财经头条数据失败 {}"
,
e
);
logger
.
error
(
"获取新浪财经头条数据失败 {}"
,
e
);
}
}
...
...
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