Last active
December 3, 2023 16:54
-
-
Save RayBB/9ee79ce8764be0818ff82d34ff8cb0c0 to your computer and use it in GitHub Desktop.
Cleanup domain search results on porkbun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MAX_RENEWAL = 20; | |
const MAX_INITIAL = 100; | |
function isUnavailable(e){return e.innerHTML.includes("unavailable")} | |
function highRenewalPrice(e){ | |
const container = e.querySelector(".searchResultRowTable .renewsAtContainer"); | |
if (!container) return false; | |
return (parseInt(container.innerText.match(/\d+/)[0]) || 0) > MAX_RENEWAL; | |
} | |
function highInitalPrice(e){ | |
const container = e.querySelector(".searchResultRowTable"); | |
if (!container) return false; | |
return (parseInt(container.innerText.replace(",", "").match(/\d+/)[0]) || 0) > MAX_INITIAL; | |
} | |
// Remove letter section headers | |
Array.from(document.querySelectorAll(".searchResultsTldLetterBox")) | |
.forEach(e=>e.remove()) | |
// Select all the removeable wells (results) | |
Array.from(document.querySelectorAll(".searchResultsSectionContainer .well")) | |
.filter(e=>{return isUnavailable(e) || highRenewalPrice(e) || highInitalPrice(e)}) | |
.forEach(e=>e.remove()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment