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
e43ea617
Commit
e43ea617
authored
Aug 08, 2019
by
zhiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复头条根据链接获取文章bug
parent
5578cebf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
pom.xml
+11
-1
src/main/java/com/zhiwei/toutiao/bean/TouTiaoArticle.java
+0
-4
src/main/java/com/zhiwei/toutiao/parse/TouTiaoArticleParse.java
+1
-1
No files found.
pom.xml
View file @
e43ea617
...
...
@@ -3,7 +3,7 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.zhiwei
</groupId>
<artifactId>
toutiao
</artifactId>
<version>
0.3.
8
-SNAPSHOT
</version>
<version>
0.3.
9
-SNAPSHOT
</version>
<dependencies>
<dependency>
...
...
@@ -18,6 +18,16 @@
<version>
0.5.2-SNAPSHOT
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
com.zhiwei
</groupId>
<artifactId>
excelpoi
</artifactId>
<version>
0.0.5-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.mongodb
</groupId>
<artifactId>
mongo-java-driver
</artifactId>
<version>
3.8.1
</version>
</dependency>
</dependencies>
<!-- 打包管理 -->
...
...
src/main/java/com/zhiwei/toutiao/bean/TouTiaoArticle.java
View file @
e43ea617
...
...
@@ -12,11 +12,7 @@ package com.zhiwei.toutiao.bean;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSONObject
;
/**
* @Description:
...
...
src/main/java/com/zhiwei/toutiao/parse/TouTiaoArticleParse.java
View file @
e43ea617
...
...
@@ -605,7 +605,7 @@ public class TouTiaoArticleParse {
//通过正则截取需要的js代码
Matcher
matcher
=
Pattern
.
compile
(
regex
).
matcher
(
htmlBody
);
if
(
matcher
.
find
())
{
String
content
=
matcher
.
group
().
replace
(
"<script>var BASE_DATA = |;</script>"
,
""
);
String
content
=
matcher
.
group
().
replace
All
(
"<script>var BASE_DATA = |;</script>"
,
""
);
//通过js引擎执行js代码
String
jsContent
=
"eval(("
+
content
+
")).articleInfo.content.toString();"
;
String
contentHtml
=
scriptEngine
.
eval
(
jsContent
).
toString
();
...
...
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