Commit f7e200cf by [zhangzhiwei]

因修改采集核心包版本,修改相应的方法

parent d6cfba56
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
<dependency> <dependency>
<groupId>com.zhiwei.tools</groupId> <groupId>com.zhiwei.tools</groupId>
<artifactId>zhiwei-tools</artifactId> <artifactId>zhiwei-tools</artifactId>
<version>0.0.5-SNAPSHOT</version> <version>0.0.8-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -18,7 +18,7 @@ public class WechatAccountFans { ...@@ -18,7 +18,7 @@ public class WechatAccountFans {
// private static Logger logger = LoggerFactory.getLogger(WechatAccountFans.class); // private static Logger logger = LoggerFactory.getLogger(WechatAccountFans.class);
private static HttpBoot httpBoot = new HttpBoot();
private Map<String,String> headerMap; private Map<String,String> headerMap;
public WechatAccountFans() public WechatAccountFans()
...@@ -44,7 +44,7 @@ public class WechatAccountFans { ...@@ -44,7 +44,7 @@ public class WechatAccountFans {
headerMap.put("Referer", referer); headerMap.put("Referer", referer);
headerMap.put("Cookie", cookie); headerMap.put("Cookie", cookie);
String htmlBody = HttpBoot.syncCall(RequestUtils.wrapGet(url, headerMap)).body().string(); String htmlBody = httpBoot.syncCall(RequestUtils.wrapGet(url, headerMap)).body().string();
if(htmlBody != null) if(htmlBody != null)
{ {
JSONObject json = JSONObject.parseObject(htmlBody); JSONObject json = JSONObject.parseObject(htmlBody);
......
...@@ -20,7 +20,7 @@ import com.zhiwei.wechat.entity.WechatAccount; ...@@ -20,7 +20,7 @@ import com.zhiwei.wechat.entity.WechatAccount;
public class WechatAccountInfo { public class WechatAccountInfo {
private static HttpBoot httpBoot = new HttpBoot();
private static Logger logger = LoggerFactory.getLogger(WechatAccountInfo.class); private static Logger logger = LoggerFactory.getLogger(WechatAccountInfo.class);
/*** /***
* @Title: getWechatAccount * @Title: getWechatAccount
...@@ -36,7 +36,7 @@ public class WechatAccountInfo { ...@@ -36,7 +36,7 @@ public class WechatAccountInfo {
String url = "http://weixin.sogou.com/weixin?type=1&query=" + id +"&ie=utf8&_sug_=n&_sug_type_="; String url = "http://weixin.sogou.com/weixin?type=1&query=" + id +"&ie=utf8&_sug_=n&_sug_type_=";
System.out.println(url); System.out.println(url);
try { try {
String htmlBody = HttpBoot.syncCall(RequestUtils.wrapGet(url),proxy,false).body().string(); String htmlBody = httpBoot.syncCall(RequestUtils.wrapGet(url),proxy,false).body().string();
if(htmlBody != null) if(htmlBody != null)
{ {
return anaSislyAccount(url,htmlBody, id, "id"); return anaSislyAccount(url,htmlBody, id, "id");
...@@ -62,7 +62,7 @@ public class WechatAccountInfo { ...@@ -62,7 +62,7 @@ public class WechatAccountInfo {
String url = "http://weixin.sogou.com/weixin?type=1&query=" + query +"&ie=utf8&_sug_=n&_sug_type_=&page="+i; String url = "http://weixin.sogou.com/weixin?type=1&query=" + query +"&ie=utf8&_sug_=n&_sug_type_=&page="+i;
logger.info("url:{}",url); logger.info("url:{}",url);
try { try {
String htmlBody = HttpBoot.syncCall(RequestUtils.wrapGet(url),proxy,false).body().string(); String htmlBody = httpBoot.syncCall(RequestUtils.wrapGet(url),proxy,false).body().string();
if(htmlBody != null) if(htmlBody != null)
{ {
WechatAccount wa = anaSislyAccount(url,htmlBody, name, "name"); WechatAccount wa = anaSislyAccount(url,htmlBody, name, "name");
...@@ -96,7 +96,7 @@ public class WechatAccountInfo { ...@@ -96,7 +96,7 @@ public class WechatAccountInfo {
String url = "http://weixin.sogou.com/weixin?type=1&query=" + query +"&ie=utf8&_sug_=n&_sug_type_=&page="+i; String url = "http://weixin.sogou.com/weixin?type=1&query=" + query +"&ie=utf8&_sug_=n&_sug_type_=&page="+i;
logger.info("url:{}",url); logger.info("url:{}",url);
try { try {
String htmlBody = HttpBoot.syncCall(RequestUtils.wrapGet(url)).body().string(); String htmlBody = httpBoot.syncCall(RequestUtils.wrapGet(url)).body().string();
if(htmlBody != null) if(htmlBody != null)
{ {
/** 解析页面 */ /** 解析页面 */
...@@ -378,7 +378,7 @@ public class WechatAccountInfo { ...@@ -378,7 +378,7 @@ public class WechatAccountInfo {
headerMap.put("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"); headerMap.put("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36");
readUrl = "http://weixin.sogou.com" + readUrl; readUrl = "http://weixin.sogou.com" + readUrl;
try { try {
String htmlBody = HttpBoot.syncCall(RequestUtils.wrapGet(readUrl,headerMap)).body().string(); String htmlBody = httpBoot.syncCall(RequestUtils.wrapGet(readUrl,headerMap)).body().string();
if(htmlBody != null) if(htmlBody != null)
{ {
JSONObject json = JSONObject.parseObject(htmlBody); JSONObject json = JSONObject.parseObject(htmlBody);
...@@ -404,7 +404,7 @@ public class WechatAccountInfo { ...@@ -404,7 +404,7 @@ public class WechatAccountInfo {
headerMap.put("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"); headerMap.put("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36");
readUrl = "http://weixin.sogou.com" + readUrl; readUrl = "http://weixin.sogou.com" + readUrl;
try { try {
String htmlBody = HttpBoot.syncCall(RequestUtils.wrapGet(readUrl,headerMap)).body().string(); String htmlBody = httpBoot.syncCall(RequestUtils.wrapGet(readUrl,headerMap)).body().string();
if(htmlBody != null) if(htmlBody != null)
{ {
JSONObject json = JSONObject.parseObject(htmlBody); JSONObject json = JSONObject.parseObject(htmlBody);
......
...@@ -16,8 +16,8 @@ import java.util.Date; ...@@ -16,8 +16,8 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.slf4j.Logger; import org.apache.logging.log4j.LogManager;
import org.slf4j.LoggerFactory; import org.apache.logging.log4j.Logger;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -37,7 +37,7 @@ import com.zhiwei.wechat.util.Tools; ...@@ -37,7 +37,7 @@ import com.zhiwei.wechat.util.Tools;
*/ */
public class WechatDataFromHistory { public class WechatDataFromHistory {
private static final Logger log = LoggerFactory.getLogger(WechatDataFromHistory.class); private static final Logger log = LogManager.getLogger(WechatDataFromHistory.class);
private boolean updateLike = false; //是否更新点赞阅读数 private boolean updateLike = false; //是否更新点赞阅读数
......
...@@ -9,12 +9,12 @@ import java.util.HashMap; ...@@ -9,12 +9,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zhiwei.crawler.core.HttpBoot; import com.zhiwei.crawler.core.HttpBoot;
...@@ -32,7 +32,8 @@ import com.zhiwei.wechat.util.Tools; ...@@ -32,7 +32,8 @@ import com.zhiwei.wechat.util.Tools;
*/ */
public class WechatAritcleSearch { public class WechatAritcleSearch {
private static Logger logger = LoggerFactory.getLogger(WechatAritcleSearch.class); private static Logger logger = LogManager.getLogger(WechatAritcleSearch.class);
private static HttpBoot httpBoot = new HttpBoot();
/** /**
* *
* @Title: wechatKeywordSearch * @Title: wechatKeywordSearch
...@@ -76,7 +77,7 @@ public class WechatAritcleSearch { ...@@ -76,7 +77,7 @@ public class WechatAritcleSearch {
} }
headerMap.put("Referer",url); headerMap.put("Referer",url);
//获取数据 //获取数据
String htmlBody = HttpBoot.syncCall(RequestUtils.wrapGet(url, headerMap), proxy, false).body().string(); String htmlBody = httpBoot.syncCall(RequestUtils.wrapGet(url, headerMap), proxy, false).body().string();
//解析数据 //解析数据
if(htmlBody != null) if(htmlBody != null)
{ {
......
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