From 932dafdfd16aba87a28889b5dc4c3247a429411c Mon Sep 17 00:00:00 2001 From: bit4woo Date: Mon, 15 Apr 2024 18:24:33 +0800 Subject: [PATCH] update --- src/InternetSearch/Client/ZoomEyeClient.java | 4 ++-- src/InternetSearch/SearchResultEntry.java | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/InternetSearch/Client/ZoomEyeClient.java b/src/InternetSearch/Client/ZoomEyeClient.java index 60c42685..db7a30d8 100644 --- a/src/InternetSearch/Client/ZoomEyeClient.java +++ b/src/InternetSearch/Client/ZoomEyeClient.java @@ -100,7 +100,7 @@ public String buildSearchUrl(String searchContent, int page) { //https://www.zoomeye.hk/api/domain/search?q=google.com&p=1&s=10&type=1 //https://www.zoomeye.hk/api/search?q=site%3A%22baidu.com%22&page=1 String url = String.format( - "https://api.zoomeye.hk/api/search?q=%s&page=%s",searchContent,page); + "https://www.zoomeye.hk/api/search?q=%s&page=%s",searchContent,page); return url; } @@ -108,7 +108,7 @@ public String buildSearchUrl(String searchContent, int page) { public byte[] buildRawData(String searchContent, int page) { //site:"baidu.com" String raw = "GET /api/search?q=%s&page=%s HTTP/1.1\r\n" - + "Host: api.zoomeye.hk\r\n" + + "Host: www.zoomeye.hk\r\n" + "Accept: application/json, text/plain, */*\r\n" + "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\r\n" + "Accept-Encoding: gzip, deflate\r\n" diff --git a/src/InternetSearch/SearchResultEntry.java b/src/InternetSearch/SearchResultEntry.java index 15c0106f..b1725b1f 100644 --- a/src/InternetSearch/SearchResultEntry.java +++ b/src/InternetSearch/SearchResultEntry.java @@ -76,7 +76,7 @@ public void setHost(String host) { if (StringUtils.isEmpty(rootDomain)) { if(DomainNameUtils.isValidDomain(host)) { - rootDomain = DomainNameUtils.getRootDomain(host); + this.rootDomain = DomainNameUtils.getRootDomain(host); } } } @@ -94,7 +94,11 @@ public String getRootDomain() { } public void setRootDomain(String rootDomain) { - this.rootDomain = rootDomain; + if(DomainNameUtils.isValidDomain(rootDomain)) { + this.rootDomain = DomainNameUtils.getRootDomain(rootDomain); + }else{ + this.rootDomain = rootDomain; + } } public String getWebcontainer() {