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
d2860d69
Commit
d2860d69
authored
Feb 05, 2018
by
zhiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复自媒体号中今日头条匹配规则
parent
b7e2a3dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
7 deletions
+30
-7
src/main/java/com/zhiwei/source_forward/util/TreateData.java
+30
-7
No files found.
src/main/java/com/zhiwei/source_forward/util/TreateData.java
View file @
d2860d69
...
...
@@ -130,31 +130,54 @@ public class TreateData {
if
(
url
.
contains
(
"toutiao.com"
)){
//今日头条帐号匹配
if
(
html
.
contains
(
" name: '"
)){
source
=
"今日头条-"
+
html
.
split
(
"name: '"
)[
1
].
split
(
"',"
)[
0
];
source
=
html
.
split
(
"name: '"
)[
1
].
split
(
"',"
)[
0
].
trim
();
}
else
if
(
html
.
contains
(
"screen_name:"
)){
source
=
html
.
split
(
"screen_name:'"
)[
1
].
split
(
"',"
)[
0
].
trim
();
}
if
(
source
!=
null
&&
!
source
.
equals
(
""
)){
source
=
"今日头条-"
+
source
;
}
}
else
if
(
url
.
contains
(
"sohu.com"
)){
//搜狐自媒体号
if
(
html
.
contains
(
"<meta name=\"mediaid\""
)){
source
=
"搜狐-"
+
html
.
split
(
"<meta name=\"mediaid\" content=\""
)[
1
].
split
(
"\""
)[
0
];
source
=
"搜狐-"
+
html
.
split
(
"<meta name=\"mediaid\" content=\""
)[
1
].
split
(
"\""
)[
0
].
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)){
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
();
source
=
document
.
select
(
"[class=\"share_cnt_p clearfix\"]"
).
select
(
"div.fl"
).
select
(
"i"
).
get
(
1
).
text
().
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)){
source
=
"东方头条-"
+
source
;
}
}
else
if
(
url
.
contains
(
"sh.qihoo.com"
)){
//今日报点解析
source
=
"今日爆点-"
+
document
.
select
(
"p.info"
).
select
(
"span.source"
).
text
();
source
=
document
.
select
(
"p.info"
).
select
(
"span.source"
).
text
().
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)){
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
];
source
=
html
.
split
(
"<meta name=\"mediaid\" content=\""
)[
1
].
split
(
"\""
)[
0
].
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)){
source
=
"财经头条-"
+
source
;
}
}
}
else
if
(
url
.
contains
(
"baijia.baidu.com"
)){
//百度百家
source
=
"百家号-"
+
document
.
select
(
"section.info"
).
select
(
"span.author"
).
text
();
source
=
document
.
select
(
"section.info"
).
select
(
"span.author"
).
text
().
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)){
source
=
"百家号-"
+
source
;
}
}
else
if
(
url
.
contains
(
"yidianzixun.com"
)){
//一点资讯
if
(
html
.
contains
(
"related_wemedia"
)){
source
=
"一点号-"
+
html
.
split
(
"media_name\":\""
)[
1
].
split
(
"\",\""
)[
0
];
source
=
html
.
split
(
"media_name\":\""
)[
1
].
split
(
"\",\""
)[
0
].
trim
();
if
(
source
!=
null
&&
!
source
.
equals
(
""
)){
source
=
"一点号-"
+
source
;
}
}
else
{
source
=
html
.
split
(
"source\":\""
)[
1
].
split
(
"\",\""
)[
0
];
}
...
...
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