Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
source_forward
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
source_forward
Commits
50524098
Commit
50524098
authored
Sep 14, 2020
by
zk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加k.sina.com.cn网址的source字段的解析规则
parent
2da35a84
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
src/main/java/com/zhiwei/source_forward/util/MatchSource.java
+6
-2
No files found.
src/main/java/com/zhiwei/source_forward/util/MatchSource.java
View file @
50524098
...
...
@@ -52,7 +52,8 @@ public class MatchSource {
* 设定文件
* @return String 返回类型
*/
public
static
String
matchSource
(
String
url
,
String
html
,
List
<
String
>
sourceList
)
{
public
static
String
matchSource
(
String
url
,
String
html
,
List
<
String
>
sourceList
)
{
String
source
=
null
;
Document
document
=
Jsoup
.
parse
(
html
);
String
htmlBody
=
TreateData
.
filterSpecialCharacter
(
document
.
select
(
"body"
).
text
().
toUpperCase
());
...
...
@@ -452,11 +453,14 @@ public class MatchSource {
source
=
"快资讯-"
+
source
;
}
}
else
if
(
url
.
contains
(
"cj.sina.com.cn"
)
||
url
.
contains
(
"finance.sina.cn"
)
||
url
.
contains
(
"tech.sina.cn"
)
||
url
.
contains
(
"news.sina.cn"
)
||
url
.
contains
(
"k.sina.cn"
)){
url
.
contains
(
"tech.sina.cn"
)
||
url
.
contains
(
"news.sina.cn"
)
||
url
.
contains
(
"k.sina.cn"
)
||
url
.
contains
(
"k.sina.com.cn"
)
){
source
=
document
.
select
(
"h2.weibo_user"
).
text
();
if
(
Objects
.
isNull
(
source
)
||
source
.
length
()
<
1
)
{
source
=
document
.
select
(
"#top_bar > div > div.date-source > a"
).
text
();
}
if
(
Objects
.
isNull
(
source
)
||
source
.
length
()
<
1
)
{
source
=
document
.
select
(
"#top_bar > div > div.date-source >span > a"
).
text
();
}
if
((
Objects
.
isNull
(
source
)
||
source
.
length
()
<
1
)
&&
html
.
contains
(
"<meta name=\"mediaid\""
)){
//新浪科技头条号
source
=
html
.
split
(
"<meta name=\"mediaid\" content=\""
)[
1
].
split
(
"\""
)[
0
].
trim
();
...
...
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