diff --git a/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java b/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java index 4a803c7..ec6ce89 100644 --- a/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java +++ b/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java @@ -33,6 +33,29 @@ public class BaiDuUtils { } return 0; },executor); + return; + } + + public static void sendUpdateSEOData(String permalink) { + if (StringUtils.isBlank(permalink) || StringUtils.isBlank(token)) { + return; + } + ExecutorService executor= new ThreadPoolExecutor(1,1,0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()); + CompletableFuture.supplyAsync(()-> { + try { + HttpResponse response = HttpRequest.post("http://data.zz.baidu.com/update?site=" + site + "&token=" + token). + header("User-Agent", "curl/7.12.1"). + header("Host", "data.zz.baidu.com"). + header("Content-Type", "text/plain"). + header("Connection", "close").body(permalink.getBytes(), "text/plain").timeout(30000).send(); + response.charset("UTF-8"); + System.out.println(response.bodyText()); + } catch (Exception e){ + e.printStackTrace(); + } + return 0; + },executor); + return; } public static void updateSEOData(String permalink) { @@ -78,6 +101,6 @@ public class BaiDuUtils { } public static void main(String[] args){ - sendSEOData("https://rymcu.com"); + sendUpdateSEOData("https://rymcu.com"); } }