更新百度SEO方法

This commit is contained in:
ronger 2020-03-11 08:56:21 +08:00
parent 40cedf40e0
commit b73dbb727e

View File

@ -33,6 +33,29 @@ public class BaiDuUtils {
} }
return 0; return 0;
},executor); },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<Runnable>());
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) { public static void updateSEOData(String permalink) {
@ -77,7 +100,7 @@ public class BaiDuUtils {
},executor); },executor);
} }
public static void main(String agrs[]){ public static void main(){
sendSEOData("https://rymcu.com/article/31"); sendUpdateSEOData("https://rymcu.com");
} }
} }