Commit 9f440187 by zhiwei

添加微信文章验证是否原创功能

parent 4fafcc87
...@@ -36,21 +36,21 @@ public class SourceForwardPageProcessor implements PageProcessor { ...@@ -36,21 +36,21 @@ public class SourceForwardPageProcessor implements PageProcessor {
String channel = "新闻"; String channel = "新闻";
try { try {
if(page.getStatusCode()!=404){ if(page.getStatusCode()!=404){
channel = TreateData.verifyChannel(page.getUrl().get());
if(channel==null){
List<Node> nodeList = page.getHtml().getDocument().head().childNodes();
channel = TreateData.matchChannel(nodeList);
}
source = TreateData.matchSource(page.getUrl().get(),page.getHtml().toString(), sourceList);
if(page.getUrl().get().contains("mp.weixin.qq.com")){ if(page.getUrl().get().contains("mp.weixin.qq.com")){
String isforward = "未知"; String isforward = "未知";
Document document = page.getHtml().getDocument(); Document document = page.getHtml().getDocument();
if(document.select("div#meta_content").select("span.rich_media_meta meta_original_tag")!=null && isforward = document.select("div#meta_content").select("span#copyright_logo").text();
!"".equals(document.select("div#meta_content").select("span.rich_media_meta meta_original_tag"))){ if(!"原创".equals(isforward)){
isforward = document.select("div#meta_content").select("span.rich_media_meta meta_original_tag").text(); isforward = "未知";
data.put("isforward", isforward); }
data.put("isforward", isforward);
}else{
channel = TreateData.verifyChannel(page.getUrl().get());
if(channel==null){
List<Node> nodeList = page.getHtml().getDocument().head().childNodes();
channel = TreateData.matchChannel(nodeList);
} }
source = TreateData.matchSource(page.getUrl().get(),page.getHtml().toString(), sourceList);
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -43,6 +43,7 @@ public class SourceForward { ...@@ -43,6 +43,7 @@ public class SourceForward {
for(Map<String,Object> sourceMap : sourceForwardList){ for(Map<String,Object> sourceMap : sourceForwardList){
String url = sourceMap.get("url")+""; String url = sourceMap.get("url")+"";
String root_source = sourceMap.get("root_source")!=null?sourceMap.get("root_source").toString():null; String root_source = sourceMap.get("root_source")!=null?sourceMap.get("root_source").toString():null;
String isForwardWX = sourceMap.get("isforward")!=null?sourceMap.get("isforward").toString():null;
String channel = sourceMap.get("channel")+""; String channel = sourceMap.get("channel")+"";
//整合数据及验证转发原创 //整合数据及验证转发原创
if(dataMap.containsKey(url)){ if(dataMap.containsKey(url)){
...@@ -54,10 +55,15 @@ public class SourceForward { ...@@ -54,10 +55,15 @@ public class SourceForward {
}else if(root_source.toUpperCase().trim().equals(source.toUpperCase().trim())){ }else if(root_source.toUpperCase().trim().equals(source.toUpperCase().trim())){
isForward = "原创"; isForward = "原创";
} }
data.put("是否转发", isForward);
data.put("原来源", root_source);
data.put("频道", channel);
if(url.contains("mp.weixin.qq.com")){
isForward = isForwardWX;
}else{
data.put("原来源", root_source);
data.put("频道", channel);
}
data.put("是否转发", isForward);
dataMap.put(url, data); dataMap.put(url, data);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment