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
26dc222c
Commit
26dc222c
authored
Nov 19, 2018
by
[zhangzhiwei]
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微头条数据处理
parent
9e236728
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
src/main/java/com/zhiwei/toutiao/parse/TouTiaoArticleParse.java
+2
-3
src/test/java/com/zhiwei/toutiao/test/TouTiaoExample.java
+8
-7
No files found.
src/main/java/com/zhiwei/toutiao/parse/TouTiaoArticleParse.java
View file @
26dc222c
...
...
@@ -188,7 +188,7 @@ public class TouTiaoArticleParse {
logger
.
info
(
"数据为null"
);
}
}
catch
(
Exception
e
)
{
logger
.
info
(
"获取数据出错::{},数据为null"
,
e
.
fillInStackTrace
()
);
logger
.
info
(
"获取数据出错::{},数据为null"
,
e
);
return
null
;
}
return
null
;
...
...
@@ -246,7 +246,6 @@ public class TouTiaoArticleParse {
continue
;
}
}
System
.
out
.
println
(
source
+
"========="
+
dataList
.
size
());
/**验证是否有下一页数据**/
if
(
more
){
if
(
max_behot_time
!=
null
&&
max_behot_time
!=
0
){
...
...
@@ -261,7 +260,7 @@ public class TouTiaoArticleParse {
e
.
printStackTrace
();
}
map
.
put
(
"max_behot_time"
,
max_behot_time
+
""
);
map
.
put
(
"max_behot_time"
,
max_behot_time
);
map
.
put
(
"data"
,
dataList
);
return
map
;
...
...
src/test/java/com/zhiwei/toutiao/test/TouTiaoExample.java
View file @
26dc222c
...
...
@@ -31,7 +31,7 @@ public class TouTiaoExample {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
long
a
=
System
.
currentTimeMillis
();
List
<
String
>
urlList
=
new
ArrayList
<
String
>();
urlList
.
add
(
"
575709125
1"
);
urlList
.
add
(
"
2378210738
1"
);
System
.
out
.
println
(
urlList
.
size
());
...
...
@@ -39,16 +39,17 @@ public class TouTiaoExample {
for
(
String
url
:
urlList
)
{
String
mid
=
url
;
String
max_behot_time
=
"0"
;
while
(
true
)
{
Long
max_behot_time
=
0L
;
boolean
f
=
true
;
while
(
f
)
{
Map
<
String
,
Object
>
dataMap
=
null
;
dataMap
=
TouTiaoArticleParse
.
getMicroTouTiaoCrawler
(
mid
,
endTime
,
null
,
max_behot_time
);
dataMap
=
TouTiaoArticleParse
.
getMicroTouTiaoCrawler
(
mid
,
endTime
,
null
,
max_behot_time
+
""
);
if
(
dataMap
!=
null
)
{
List
<
TouTiaoArticle
>
ttlist
=
(
List
<
TouTiaoArticle
>)
dataMap
.
get
(
"data"
);
max_behot_time
=
(
String
)
dataMap
.
get
(
"max_behot_time"
);
max_behot_time
=
(
Long
)
dataMap
.
get
(
"max_behot_time"
);
System
.
out
.
println
(
max_behot_time
+
"======="
+
ttlist
.
size
());
if
(
max_behot_time
==
null
||
ttlist
.
isEmpty
())
{
break
;
if
(
null
==
max_behot_time
||
ttlist
.
isEmpty
())
{
f
=
false
;
}
else
{
if
(
ttlist
.
size
()
>
0
)
{
for
(
TouTiaoArticle
tt
:
ttlist
)
{
...
...
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