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
fd10ecff
Commit
fd10ecff
authored
Jan 10, 2019
by
yangchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加:网易号、大风号、企鹅号、北京时间自媒体匹配
parent
a71c606b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
10 deletions
+35
-10
src/main/java/com/zhiwei/source_forward/util/MatchSource.java
+35
-10
No files found.
src/main/java/com/zhiwei/source_forward/util/MatchSource.java
View file @
fd10ecff
...
...
@@ -130,21 +130,21 @@ public class MatchSource {
}
else
if
(
html
.
contains
(
"screen_name:"
)){
source
=
html
.
split
(
"screen_name:'"
)[
1
].
split
(
"',"
)[
0
].
trim
();
}
if
(
source
!=
null
&&
!
source
.
equals
(
""
)
){
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"今日头条-"
+
source
;
}
}
else
if
(
url
.
contains
(
"sohu.com"
)){
//搜狐自媒体号
if
(
html
.
contains
(
"<meta name=\"mediaid\""
)){
source
=
html
.
split
(
"<meta name=\"mediaid\" content=\""
)[
1
].
split
(
"\""
)[
0
].
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)
){
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"搜狐-"
+
source
;
}
}
}
else
if
(
url
.
contains
(
"a.mini.eastday.com"
)){
//处理东方头条网-自媒体号匹配
source
=
document
.
select
(
"[class=\"share_cnt_p clearfix\"]"
).
select
(
"div.fl"
).
select
(
"i"
).
get
(
1
).
text
().
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)
){
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"东方头条-"
+
source
;
}
}
else
if
(
url
.
contains
(
"sh.qihoo.com"
)){
...
...
@@ -153,49 +153,74 @@ public class MatchSource {
if
(
source
.
length
()
<
2
)
{
source
=
document
.
select
(
"p.article-info"
).
select
(
"a"
).
text
().
trim
();
}
if
(
source
!=
null
&&
!
source
.
equals
(
""
)
){
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"快资讯-"
+
source
;
}
}
else
if
(
url
.
contains
(
"cj.sina.com.cn"
)){
//新浪财经头条号
if
(
html
.
contains
(
"<meta name=\"mediaid\""
)){
source
=
html
.
split
(
"<meta name=\"mediaid\" content=\""
)[
1
].
split
(
"\""
)[
0
].
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)
){
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"财经头条-"
+
source
;
}
}
}
else
if
(
url
.
contains
(
"baijiahao.baidu.com"
)){
//百度百家
source
=
document
.
select
(
"div.author"
).
select
(
"div.author-txt"
).
select
(
"p.author-name"
).
text
().
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)
){
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"百度百家-"
+
source
;
}
}
else
if
(
url
.
contains
(
"yidianzixun.com"
)){
//一点资讯
if
(
html
.
contains
(
"related_wemedia"
)){
source
=
html
.
split
(
"media_name\":\""
)[
1
].
split
(
"\",\""
)[
0
].
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)
){
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"一点资讯-"
+
source
;
}
}
else
{
source
=
html
.
split
(
"source\":\""
)[
1
].
split
(
"\",\""
)[
0
];
}
}
else
if
(
url
.
contains
(
"news.bitauto.com"
)){
//易车网
source
=
document
.
select
(
"[class=\"gz-box clearfix\"]"
).
select
(
"div.txt-box"
)
.
select
(
"p.p-n"
).
select
(
"a"
).
text
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)
){
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"易车网-"
+
source
;
}
}
else
if
(
url
.
contains
(
"chejiahao.autohome.com.cn"
)){
//汽车之家
source
=
document
.
select
(
"div.authorMes"
).
select
(
"[class=\"name text-overflow\"]"
)
.
select
(
"a"
).
text
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)
){
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"汽车之家-"
+
source
;
}
}
else
if
(
url
.
contains
(
"item.btime.com"
)){
//北京时间
source
=
document
.
select
(
"a.author"
).
text
();
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"北京时间-"
+
source
;
}
}
else
if
(
url
.
contains
(
"new.qq.com/omn/"
)){
//腾讯网-企鹅号
source
=
html
.
split
(
"media\":\""
)[
1
].
split
(
"\",\""
)[
0
];
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"企鹅号-"
+
source
;
}
}
else
if
(
url
.
contains
(
"feng.ifeng.com"
)){
//凤凰网-大风号
source
=
html
.
split
(
"source\":\""
)[
1
].
split
(
"\",\""
)[
0
];
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"大风号-"
+
source
;
}
}
else
if
(
url
.
contains
(
"dy.163.com"
)){
//网易订阅-网易号
source
=
document
.
select
(
"div.colum_info>h4"
).
text
();
if
(
source
!=
null
&&
source
.
length
()>
1
){
source
=
"网易号-"
+
source
;
}
}
return
source
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
...
...
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