https://www.seomemento.com/bookmarklet-domaines-expires/?ref=seo-memento-newsletter
// Fonction pour extraire le nom de domaine d'une URL
function getDomain(url) {
var a = document.createElement('a');
a.href = url;
return a.hostname;
}
// Fonction pour interroger l'API Domainr pour le statut de domaine
function getStatus(domain, link) {
return fetch(`https://domainr.p.rapidapi.com/v2/status?mashape-key=d19d098141msh076c1976c3d82a8p1bb089jsnf9c8740386de&domain=${domain}`)
.then(response => response.json())
.then(data => {
var status = data.status[0].status;
if (status.indexOf("inactive") !== -1) {
link.style.backgroundColor = "yellow";
link.style.padding = "2px";
link.style.fontWeight = "bold";
link.style.fontSize = "larger";
link.style.color = "red";
return domain;
}
})
.catch(error => console.error(error))
}
// Recherche de tous les liens externes de la page
var promises = [];
var currentDomain = getDomain(window.location.href);
var links = document.querySelectorAll('a[href^="http"]');
for (var i = 0; i < links.length; i++) {
var link = links[i];
var domain = getDomain(link.href);
if (domain !== currentDomain) { // Vérifie si le lien pointe vers un domaine différent du domaine en cours
promises.push(getStatus(domain, link));
}
}
Promise.all(promises)
.then(inactiveDomains => {
inactiveDomains = [...new Set(inactiveDomains.filter(Boolean))];
if (inactiveDomains.length > 0) {
var message = "Les domaines inactifs sont : \n" + inactiveDomains.join("\n");
alert(message);
} else {
alert('Aucun domaine inactif n\'a été trouvé');
}
});
X-RapidAPI-Key': 'd19d098141msh076c1976c3d82a8p1bb089jsnf9c8740386de
❓NDD BOOKMARKLET
javascript:void%20function(){function%20a(b){var%20c=document.createElement(%22a%22);return%20c.href=b,c.hostname}function%20b(a,b){return%20fetch(`https://domainr.p.rapidapi.com/v2/status%3Fmashape-key=d19d098141msh076c1976c3d82a8p1bb089jsnf9c8740386de%26domain=${a}`).then(a=%3Ea.json()).then(c=%3E{var%20d=c.status[0].status;if(-1!==d.indexOf(%22inactive%22))return%20b.style.backgroundColor=%22yellow%22,b.style.padding=%222px%22,b.style.fontWeight=%22bold%22,b.style.fontSize=%22larger%22,b.style.color=%22red%22,a}).catch(a=%3Econsole.error(a))}for(var%20c=[],d=a(window.location.href),e=document.querySelectorAll(%22a[href^=\%22http\%22]%22),f=0;f%3Ce.length;f++){var%20g=e[f],h=a(g.href);h!==d%26%26c.push(b(h,g))}Promise.all(c).then(a=%3E{if(a=[...new%20Set(a.filter(Boolean))],0%3Ca.length){var%20b=%22Les%20domaines%20inactifs%20sont%20:%20\n%22+a.join(%22\n%22);alert(b)}else%20alert(%22Aucun%20domaine%20inactif%20n'a%20\xE9t\xE9%20trouv\xE9%22)})}();
javascript:void function(){function a(b){var c=document.createElement("a");return c.href=b,c.hostname}function b(a,b){return fetch(`https://domainr.p.rapidapi.com/v2/status%3Fmashape-key=d19d098141msh076c1976c3d82a8p1bb089jsnf9c8740386de%26domain=${a}`).then(a=>a.json()).then(c=>{var d=c.status[0].status;if(-1!==d.indexOf("inactive"))return b.style.backgroundColor="yellow",b.style.padding="2px",b.style.fontWeight="bold",b.style.fontSize="larger",b.style.color="red",a}).catch(a=>console.error(a))}for(var c=[],d=a(window.location.href),e=document.querySelectorAll("a[href^=\"http\"]"),f=0;f<e.length;f++){var g=e[f],h=a(g.href);h!==d%26%26c.push(b(h,g))}Promise.all(c).then(a=>{if(a=[...new Set(a.filter(Boolean))],0<a.length){var b="Les domaines inactifs sont : \n"+a.join("\n");alert(b)}else alert("Aucun domaine inactif n'a \xE9t\xE9 trouv\xE9")})}();