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
86410e60
Commit
86410e60
authored
Jun 14, 2019
by
zhiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加点赞数
parent
9db65425
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
7 deletions
+21
-7
pom.xml
+1
-1
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 @
86410e60
...
...
@@ -3,7 +3,7 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.zhiwei
</groupId>
<artifactId>
toutiao
</artifactId>
<version>
0.3.
5
-SNAPSHOT
</version>
<version>
0.3.
6
-SNAPSHOT
</version>
<dependencies>
<dependency>
...
...
src/main/java/com/zhiwei/toutiao/bean/TouTiaoArticle.java
View file @
86410e60
...
...
@@ -34,9 +34,17 @@ public class TouTiaoArticle implements Serializable{
private
String
playCount
;
private
String
readNum
;
private
String
shareNum
;
private
String
likeNum
;
private
List
<
String
>
labelList
;
private
String
articleType
;
public
String
getLikeNum
()
{
return
likeNum
;
}
public
void
setLikeNum
(
String
likeNum
)
{
this
.
likeNum
=
likeNum
;
}
public
String
getArticleType
()
{
return
articleType
;
}
...
...
@@ -121,7 +129,7 @@ public class TouTiaoArticle implements Serializable{
public
TouTiaoArticle
(
String
url
,
String
title
,
String
user_id
,
String
source
,
Date
time
,
String
content
,
String
commentCount
,
String
playCount
,
String
readNum
,
String
shareNum
,
String
type
,
String
articleType
)
,
String
articleType
,
String
likeNum
)
{
this
.
url
=
url
;
this
.
title
=
title
;
...
...
@@ -135,6 +143,7 @@ public class TouTiaoArticle implements Serializable{
this
.
shareNum
=
shareNum
;
this
.
commentCount
=
commentCount
;
this
.
articleType
=
articleType
;
this
.
likeNum
=
likeNum
;
}
public
String
toString
()
...
...
src/main/java/com/zhiwei/toutiao/parse/TouTiaoArticleParse.java
View file @
86410e60
...
...
@@ -222,6 +222,7 @@ public class TouTiaoArticleParse {
String
user_id
=
null
;
String
articleType
=
null
;
List
<
String
>
labelList
=
null
;
String
likeNum
=
null
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
try
{
JSONObject
data
=
jsonArray
.
getJSONObject
(
i
);
...
...
@@ -240,7 +241,7 @@ public class TouTiaoArticleParse {
user_id
=
data
.
getLong
(
"creator_uid"
)
+
""
;
articleType
=
data
.
getString
(
"chinese_tag"
);
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"
))
{
labelList
=
data
.
getJSONArray
(
"label"
).
toJavaList
(
String
.
class
);
tt
.
setLabelList
(
labelList
);
...
...
@@ -289,6 +290,7 @@ public class TouTiaoArticleParse {
String
source
=
null
;
String
articleType
=
null
;
List
<
String
>
labelList
=
null
;
String
likeNum
=
null
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
try
{
JSONObject
data
=
jsonArray
.
getJSONObject
(
i
);
...
...
@@ -306,7 +308,7 @@ public class TouTiaoArticleParse {
source
=
data
.
getString
(
"source"
);
articleType
=
data
.
getString
(
"chinese_tag"
);
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"
))
{
labelList
=
data
.
getJSONArray
(
"label"
).
toJavaList
(
String
.
class
);
tt
.
setLabelList
(
labelList
);
...
...
@@ -505,6 +507,7 @@ public class TouTiaoArticleParse {
String
commentNum
=
null
;
String
playNum
=
null
;
String
user_id
=
null
;
String
likeNum
=
null
;
String
articleType
=
null
;
int
count
=
16
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
...
...
@@ -525,6 +528,7 @@ public class TouTiaoArticleParse {
source
=
comment_base
.
getJSONObject
(
"user"
).
getJSONObject
(
"info"
).
getString
(
"name"
);
content
=
dataJSON
.
getString
(
"content"
);
readNum
=
dataJSON
.
getJSONObject
(
"action"
).
getInteger
(
"read_count"
)
+
""
;
likeNum
=
dataJSON
.
getJSONObject
(
"action"
).
getInteger
(
"digg_count"
)+
""
;
commentNum
=
dataJSON
.
getJSONObject
(
"action"
).
getInteger
(
"comment_count"
)
+
""
;
user_id
=
comment_base
.
getJSONObject
(
"user"
).
getJSONObject
(
"info"
).
getString
(
"user_id"
);
if
(
content
!=
null
&&
!
""
.
equals
(
content
))
{
...
...
@@ -541,6 +545,7 @@ public class TouTiaoArticleParse {
content
=
dataJSON
.
getString
(
"content"
);
readNum
=
dataJSON
.
getInteger
(
"read_count"
)
+
""
;
commentNum
=
dataJSON
.
getInteger
(
"comment_count"
)
+
""
;
likeNum
=
dataJSON
.
getInteger
(
"digg_count"
)+
""
;
user_id
=
dataJSON
.
getJSONObject
(
"user"
).
getString
(
"user_id"
);
if
(
content
!=
null
&&
!
""
.
equals
(
content
))
{
if
(
content
.
length
()
<
16
)
{
...
...
@@ -550,7 +555,7 @@ public class TouTiaoArticleParse {
}
}
TouTiaoArticle
tt
=
new
TouTiaoArticle
(
href
,
title
,
user_id
,
source
,
date
,
content
,
commentNum
,
playNum
,
readNum
,
"0"
,
"微头条"
,
articleType
);
playNum
,
readNum
,
"0"
,
"微头条"
,
articleType
,
likeNum
);
dataList
.
add
(
tt
);
}
catch
(
Exception
e
)
{
continue
;
...
...
src/main/java/com/zhiwei/toutiao/parse/TouTiaoParse.java
View file @
86410e60
...
...
@@ -119,7 +119,7 @@ public class TouTiaoParse {
String
shareNum
=
data
.
getString
(
"share_count"
);
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
);
}
else
{
...
...
src/main/java/com/zhiwei/toutiao/parse/TouTiaoSearchParse.java
View file @
86410e60
...
...
@@ -95,7 +95,7 @@ public class TouTiaoSearchParse {
String
user_id
=
jso
.
getString
(
"user_id"
);
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
);
}
catch
(
JSONException
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