Skip to content

Instantly share code, notes, and snippets.

@panesofglass
Created April 7, 2018 04:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panesofglass/db4d4a484db07b28cc0f323d9170ba27 to your computer and use it in GitHub Desktop.
Save panesofglass/db4d4a484db07b28cc0f323d9170ba27 to your computer and use it in GitHub Desktop.
Fetch all tag urls on stackoverflow.com
fetch ('https://stackoverflow.com/').then(response => response.text()).then(html => {
let fragment = document.createRange().createContextualFragment(html);
let content = fragment.querySelectorAll('[rel=tag]');
for (let el of content) {
console.log(el.getAttribute('href'));
}
}).catch(error => console.error(error));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment