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
22ad3587
Commit
22ad3587
authored
Jul 16, 2019
by
[zhangzhiwei]
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.zhiweidata.top/zhangzhiwei/toutiao.git
parents
d7da84ad
bf4479e0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
8 deletions
+22
-8
pom.xml
+2
-2
src/main/java/com/zhiwei/toutiao/bean/TouTiaoArticle.java
+10
-1
src/main/java/com/zhiwei/toutiao/parse/TouTiaoArticleParse.java
+8
-3
src/main/java/com/zhiwei/toutiao/parse/TouTiaoParse.java
+1
-1
src/main/java/com/zhiwei/toutiao/parse/TouTiaoSearchParse.java
+1
-1
No files found.
pom.xml
View file @
22ad3587
...
@@ -9,13 +9,13 @@
...
@@ -9,13 +9,13 @@
<dependency>
<dependency>
<groupId>
com.zhiwei.tools
</groupId>
<groupId>
com.zhiwei.tools
</groupId>
<artifactId>
zhiwei-tools
</artifactId>
<artifactId>
zhiwei-tools
</artifactId>
<version>
0.1.
3
-SNAPSHOT
</version>
<version>
0.1.
4
-SNAPSHOT
</version>
<scope>
provided
</scope>
<scope>
provided
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.zhiwei.crawler
</groupId>
<groupId>
com.zhiwei.crawler
</groupId>
<artifactId>
crawler-core
</artifactId>
<artifactId>
crawler-core
</artifactId>
<version>
0.
3.6-RELEASE
</version>
<version>
0.
5.2-SNAPSHOT
</version>
<scope>
provided
</scope>
<scope>
provided
</scope>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
src/main/java/com/zhiwei/toutiao/bean/TouTiaoArticle.java
View file @
22ad3587
...
@@ -34,9 +34,17 @@ public class TouTiaoArticle implements Serializable{
...
@@ -34,9 +34,17 @@ public class TouTiaoArticle implements Serializable{
private
String
playCount
;
private
String
playCount
;
private
String
readNum
;
private
String
readNum
;
private
String
shareNum
;
private
String
shareNum
;
private
String
likeNum
;
private
List
<
String
>
labelList
;
private
List
<
String
>
labelList
;
private
String
articleType
;
private
String
articleType
;
public
String
getLikeNum
()
{
return
likeNum
;
}
public
void
setLikeNum
(
String
likeNum
)
{
this
.
likeNum
=
likeNum
;
}
public
String
getArticleType
()
{
public
String
getArticleType
()
{
return
articleType
;
return
articleType
;
}
}
...
@@ -121,7 +129,7 @@ public class TouTiaoArticle implements Serializable{
...
@@ -121,7 +129,7 @@ public class TouTiaoArticle implements Serializable{
public
TouTiaoArticle
(
String
url
,
String
title
,
String
user_id
,
public
TouTiaoArticle
(
String
url
,
String
title
,
String
user_id
,
String
source
,
Date
time
,
String
content
,
String
commentCount
,
String
source
,
Date
time
,
String
content
,
String
commentCount
,
String
playCount
,
String
readNum
,
String
shareNum
,
String
type
String
playCount
,
String
readNum
,
String
shareNum
,
String
type
,
String
articleType
)
,
String
articleType
,
String
likeNum
)
{
{
this
.
url
=
url
;
this
.
url
=
url
;
this
.
title
=
title
;
this
.
title
=
title
;
...
@@ -135,6 +143,7 @@ public class TouTiaoArticle implements Serializable{
...
@@ -135,6 +143,7 @@ public class TouTiaoArticle implements Serializable{
this
.
shareNum
=
shareNum
;
this
.
shareNum
=
shareNum
;
this
.
commentCount
=
commentCount
;
this
.
commentCount
=
commentCount
;
this
.
articleType
=
articleType
;
this
.
articleType
=
articleType
;
this
.
likeNum
=
likeNum
;
}
}
public
String
toString
()
public
String
toString
()
...
...
src/main/java/com/zhiwei/toutiao/parse/TouTiaoArticleParse.java
View file @
22ad3587
...
@@ -222,6 +222,7 @@ public class TouTiaoArticleParse {
...
@@ -222,6 +222,7 @@ public class TouTiaoArticleParse {
String
user_id
=
null
;
String
user_id
=
null
;
String
articleType
=
null
;
String
articleType
=
null
;
List
<
String
>
labelList
=
null
;
List
<
String
>
labelList
=
null
;
String
likeNum
=
null
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
try
{
try
{
JSONObject
data
=
jsonArray
.
getJSONObject
(
i
);
JSONObject
data
=
jsonArray
.
getJSONObject
(
i
);
...
@@ -240,7 +241,7 @@ public class TouTiaoArticleParse {
...
@@ -240,7 +241,7 @@ public class TouTiaoArticleParse {
user_id
=
data
.
getLong
(
"creator_uid"
)
+
""
;
user_id
=
data
.
getLong
(
"creator_uid"
)
+
""
;
articleType
=
data
.
getString
(
"chinese_tag"
);
articleType
=
data
.
getString
(
"chinese_tag"
);
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
href
,
title
,
user_id
,
source
,
date
,
content
,
commentNum
,
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
href
,
title
,
user_id
,
source
,
date
,
content
,
commentNum
,
playNum
,
readNum
,
shareNum
,
"今日头条"
,
articleType
);
playNum
,
readNum
,
shareNum
,
"今日头条"
,
articleType
,
likeNum
);
if
(
data
.
containsKey
(
"label"
))
{
if
(
data
.
containsKey
(
"label"
))
{
labelList
=
data
.
getJSONArray
(
"label"
).
toJavaList
(
String
.
class
);
labelList
=
data
.
getJSONArray
(
"label"
).
toJavaList
(
String
.
class
);
tt
.
setLabelList
(
labelList
);
tt
.
setLabelList
(
labelList
);
...
@@ -289,6 +290,7 @@ public class TouTiaoArticleParse {
...
@@ -289,6 +290,7 @@ public class TouTiaoArticleParse {
String
source
=
null
;
String
source
=
null
;
String
articleType
=
null
;
String
articleType
=
null
;
List
<
String
>
labelList
=
null
;
List
<
String
>
labelList
=
null
;
String
likeNum
=
null
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
try
{
try
{
JSONObject
data
=
jsonArray
.
getJSONObject
(
i
);
JSONObject
data
=
jsonArray
.
getJSONObject
(
i
);
...
@@ -306,7 +308,7 @@ public class TouTiaoArticleParse {
...
@@ -306,7 +308,7 @@ public class TouTiaoArticleParse {
source
=
data
.
getString
(
"source"
);
source
=
data
.
getString
(
"source"
);
articleType
=
data
.
getString
(
"chinese_tag"
);
articleType
=
data
.
getString
(
"chinese_tag"
);
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
href
,
title
,
user_id
,
source
,
date
,
content
,
commentNum
,
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
href
,
title
,
user_id
,
source
,
date
,
content
,
commentNum
,
playNum
,
readNum
,
shareNum
,
"今日头条"
,
articleType
);
playNum
,
readNum
,
shareNum
,
"今日头条"
,
articleType
,
likeNum
);
if
(
data
.
containsKey
(
"label"
))
{
if
(
data
.
containsKey
(
"label"
))
{
labelList
=
data
.
getJSONArray
(
"label"
).
toJavaList
(
String
.
class
);
labelList
=
data
.
getJSONArray
(
"label"
).
toJavaList
(
String
.
class
);
tt
.
setLabelList
(
labelList
);
tt
.
setLabelList
(
labelList
);
...
@@ -505,6 +507,7 @@ public class TouTiaoArticleParse {
...
@@ -505,6 +507,7 @@ public class TouTiaoArticleParse {
String
commentNum
=
null
;
String
commentNum
=
null
;
String
playNum
=
null
;
String
playNum
=
null
;
String
user_id
=
null
;
String
user_id
=
null
;
String
likeNum
=
null
;
String
articleType
=
null
;
String
articleType
=
null
;
int
count
=
16
;
int
count
=
16
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
...
@@ -525,6 +528,7 @@ public class TouTiaoArticleParse {
...
@@ -525,6 +528,7 @@ public class TouTiaoArticleParse {
source
=
comment_base
.
getJSONObject
(
"user"
).
getJSONObject
(
"info"
).
getString
(
"name"
);
source
=
comment_base
.
getJSONObject
(
"user"
).
getJSONObject
(
"info"
).
getString
(
"name"
);
content
=
dataJSON
.
getString
(
"content"
);
content
=
dataJSON
.
getString
(
"content"
);
readNum
=
dataJSON
.
getJSONObject
(
"action"
).
getInteger
(
"read_count"
)
+
""
;
readNum
=
dataJSON
.
getJSONObject
(
"action"
).
getInteger
(
"read_count"
)
+
""
;
likeNum
=
dataJSON
.
getJSONObject
(
"action"
).
getInteger
(
"digg_count"
)+
""
;
commentNum
=
dataJSON
.
getJSONObject
(
"action"
).
getInteger
(
"comment_count"
)
+
""
;
commentNum
=
dataJSON
.
getJSONObject
(
"action"
).
getInteger
(
"comment_count"
)
+
""
;
user_id
=
comment_base
.
getJSONObject
(
"user"
).
getJSONObject
(
"info"
).
getString
(
"user_id"
);
user_id
=
comment_base
.
getJSONObject
(
"user"
).
getJSONObject
(
"info"
).
getString
(
"user_id"
);
if
(
content
!=
null
&&
!
""
.
equals
(
content
))
{
if
(
content
!=
null
&&
!
""
.
equals
(
content
))
{
...
@@ -541,6 +545,7 @@ public class TouTiaoArticleParse {
...
@@ -541,6 +545,7 @@ public class TouTiaoArticleParse {
content
=
dataJSON
.
getString
(
"content"
);
content
=
dataJSON
.
getString
(
"content"
);
readNum
=
dataJSON
.
getInteger
(
"read_count"
)
+
""
;
readNum
=
dataJSON
.
getInteger
(
"read_count"
)
+
""
;
commentNum
=
dataJSON
.
getInteger
(
"comment_count"
)
+
""
;
commentNum
=
dataJSON
.
getInteger
(
"comment_count"
)
+
""
;
likeNum
=
dataJSON
.
getInteger
(
"digg_count"
)+
""
;
user_id
=
dataJSON
.
getJSONObject
(
"user"
).
getString
(
"user_id"
);
user_id
=
dataJSON
.
getJSONObject
(
"user"
).
getString
(
"user_id"
);
if
(
content
!=
null
&&
!
""
.
equals
(
content
))
{
if
(
content
!=
null
&&
!
""
.
equals
(
content
))
{
if
(
content
.
length
()
<
16
)
{
if
(
content
.
length
()
<
16
)
{
...
@@ -550,7 +555,7 @@ public class TouTiaoArticleParse {
...
@@ -550,7 +555,7 @@ public class TouTiaoArticleParse {
}
}
}
}
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
href
,
title
,
user_id
,
source
,
date
,
content
,
commentNum
,
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
href
,
title
,
user_id
,
source
,
date
,
content
,
commentNum
,
playNum
,
readNum
,
"0"
,
"微头条"
,
articleType
);
playNum
,
readNum
,
"0"
,
"微头条"
,
articleType
,
likeNum
);
dataList
.
add
(
tt
);
dataList
.
add
(
tt
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
continue
;
continue
;
...
...
src/main/java/com/zhiwei/toutiao/parse/TouTiaoParse.java
View file @
22ad3587
...
@@ -119,7 +119,7 @@ public class TouTiaoParse {
...
@@ -119,7 +119,7 @@ public class TouTiaoParse {
String
shareNum
=
data
.
getString
(
"share_count"
);
String
shareNum
=
data
.
getString
(
"share_count"
);
if
(
endData
.
before
(
date
))
{
if
(
endData
.
before
(
date
))
{
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
href
,
title
,
null
,
source
,
date
,
content
,
commentNum
,
playNum
,
readNum
,
shareNum
,
"今日头条"
,
null
);
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
href
,
title
,
null
,
source
,
date
,
content
,
commentNum
,
playNum
,
readNum
,
shareNum
,
"今日头条"
,
null
,
null
);
dataList
.
add
(
tt
);
dataList
.
add
(
tt
);
}
else
}
else
{
{
...
...
src/main/java/com/zhiwei/toutiao/parse/TouTiaoSearchParse.java
View file @
22ad3587
...
@@ -95,7 +95,7 @@ public class TouTiaoSearchParse {
...
@@ -95,7 +95,7 @@ public class TouTiaoSearchParse {
String
user_id
=
jso
.
getString
(
"user_id"
);
String
user_id
=
jso
.
getString
(
"user_id"
);
Date
date
=
TimeParse
.
stringFormartDate
(
time
);
Date
date
=
TimeParse
.
stringFormartDate
(
time
);
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
url
,
title
,
user_id
,
source
,
date
,
content
,
comment_count
,
"-1"
,
"-1"
,
"-1"
,
"今日头条"
,
null
);
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
url
,
title
,
user_id
,
source
,
date
,
content
,
comment_count
,
"-1"
,
"-1"
,
"-1"
,
"今日头条"
,
null
,
null
);
ttList
.
add
(
tt
);
ttList
.
add
(
tt
);
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
logger
.
debug
(
"解析数据出现问题 {}"
,
e
);
logger
.
debug
(
"解析数据出现问题 {}"
,
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