Closed ghost closed 3 years ago
func main() { domainCatogory("google.com", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") } func domainCatogory(url string, apiKey string) bool { response, err := http.Get(fmt.Sprint("https://www.virustotal.com/vtapi/v2/domain/report?apikey=" + apiKey + "&domain=" + url)) if err != nil { log.Println(err) } body, err := io.ReadAll(response.Body) if err != nil { log.Println(err) } if response.StatusCode == 200 { if strings.Contains(string(body), "Ads/Analytics") || strings.Contains(string(body), "advertisements") || strings.Contains(string(body), "web analytics") { return true } defer response.Body.Close() } else { time.Sleep(60 * time.Second) } return false }
Note: Do not push this code to production.