Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const getDomainInfos = (url) => {
- return axios.get(url)
- .then(r => {
- const {status} = r
- const $ = cheerio.load(r.data)
- const title = $("title").text()
- const lang = $("html").attr("lang")
- const split = lang ? lang.split("-") : [null]
- return [status, title, ...split]
- })
- .catch(err => `Error with ${url}`)
- }
- module.exports = (res1, res2) => {
- if (Array.isArray(res2) && !Array.isArray(res1)) return true
- if (!Array.isArray(res2)) return false
- if (res1.length >= res2.length) return false
- return true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement