Created
February 24, 2023 21:07
-
-
Save ThisIsMissEm/57e5a773a3758b7520b633e5700e288e to your computer and use it in GitHub Desktop.
Namecheap doesn't provide a CSV of all their current prices, and when you download your domains list as CSV, they don't give you the price that domain will renew at. They do have a pricing table at https://www.namecheap.com/domains/#pricing which running the following snippet will produce a string of CSV data that is the current pricing informat…
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 rows = document.querySelectorAll("#pricing tbody > tr"); | |
let csv = "TLD,Register Price,Special Price,Renew Price,Special Renew Price\n"; | |
for(let row of rows) { | |
let tld = row.querySelector(".gb-tld-name").innerText; | |
let newPrice = "",newPriceSpecial = "",renewPrice = "",renewPriceSpecial = ""; | |
let $NewPrice = row.querySelector("td:nth-child(2) > span:not(.gb-price--sale)"); | |
let $RenewPrice = row.querySelector("td:nth-child(3) > span:not(.gb-price--sale)"); | |
if ($NewPrice) { | |
newPrice = $NewPrice.innerText.substr(1); | |
} else { | |
newPrice = row.querySelector("td:nth-child(2) > .gb-price--special .gb-text--through").innerText.substr(1); | |
newPriceSpecial = row.querySelector("td:nth-child(2) > .gb-price--sale").innerText.substr(1); | |
} | |
if ($RenewPrice) { | |
renewPrice = $RenewPrice.innerText.substr(1); | |
} else { | |
renewPrice = row.querySelector("td:nth-child(3) > .gb-price--special .gb-text--through").innerText.substr(1); | |
renewPriceSpecial = row.querySelector("td:nth-child(3) > .gb-price--sale").innerText.substr(1); | |
} | |
csv += `${tld},${newPrice},${newPriceSpecial},${renewPrice},${renewPriceSpecial}\n`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment