Skip to content

Instantly share code, notes, and snippets.

@valentinvieriu
Forked from solrevdev/random-domain-name.js
Created October 11, 2020 08:22
Show Gist options
  • Save valentinvieriu/67b7552129754d4e2eec4539c76a4426 to your computer and use it in GitHub Desktop.
Save valentinvieriu/67b7552129754d4e2eec4539c76a4426 to your computer and use it in GitHub Desktop.
gets a random domain name from https://www.domainsfortherestofus.com/ via cors-anywhere
(async function () {
const response = await fetch('https://cors-anywhere.herokuapp.com/https://www.domainsfortherestofus.com/');
const text = await response.text();
const parser = new DOMParser();
const document = parser.parseFromString(text, 'text/html');
const domain = document.querySelector("body > div.content > div > div > div.left-side > div.domain > a").text;
console.log('domain', domain);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment