Update core.clj
This commit is contained in:
parent
30e0110cb7
commit
5cff50d1d9
@ -1,26 +1,15 @@
|
|||||||
(ns wordpress-used.core
|
(ns wordpress-used.core
|
||||||
(:require
|
(:require
|
||||||
[clj-http.client :as client]
|
|
||||||
[clojure.data.csv :as csv]
|
[clojure.data.csv :as csv]
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
[clojure.java.shell :as shell]
|
[clojure.java.shell :as shell]
|
||||||
) (:gen-class))
|
) (:gen-class))
|
||||||
|
|
||||||
(def headers {"User-Agent" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0"
|
(defn request
|
||||||
"Accept" "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
|
"Make a request by means of curl"
|
||||||
"Accept-Language" "es,en-US;q=0.7,en;q=0.3"
|
[url]
|
||||||
"Accept-Encoding" "gzip, deflate, br"
|
(shell/sh "curl" "-L" "-m" "5" "-H" "User-Agent: Firefox" url))
|
||||||
"DNT" "1"
|
|
||||||
"Connection" "keep-alive"
|
|
||||||
"Upgrade-Insecure-Requests" "1"
|
|
||||||
"Pragma" "no-cache"
|
|
||||||
"Cache-Control" "no-cache"
|
|
||||||
"TE" "Trailers"})
|
|
||||||
(def http-config
|
|
||||||
{:headers headers
|
|
||||||
:ignore-unknown-host? true
|
|
||||||
:connection-timeout 5000
|
|
||||||
:throw-exceptions false})
|
|
||||||
|
|
||||||
(defn read-csv-domains
|
(defn read-csv-domains
|
||||||
"Read CSV file with all domains"
|
"Read CSV file with all domains"
|
||||||
@ -31,11 +20,8 @@
|
|||||||
(defn wordpress?
|
(defn wordpress?
|
||||||
"Check if a web page is generated with WordPress"
|
"Check if a web page is generated with WordPress"
|
||||||
[url]
|
[url]
|
||||||
(try
|
(let [response (request url)]
|
||||||
(let [response (client/get (str "http://" url "/") http-config)]
|
(every? identity [(re-find (re-pattern "meta.*generator.*WordPress") (:out response))])))
|
||||||
(every? identity [(re-find (re-pattern "meta.*generator.*WordPress") (:body response))]))
|
|
||||||
(catch Exception e
|
|
||||||
"timeout")))
|
|
||||||
|
|
||||||
(defn -main
|
(defn -main
|
||||||
[& args]
|
[& args]
|
||||||
|
Loading…
Reference in New Issue
Block a user