📌 19 de Fevereiro, 2025
Browser: Extract All Links from a Website Without Extensions
Sometimes, you may want to quickly grab all the links from a webpage without using third-party extensions. This guide will show you how to extract all links using only your browser.
1. Open the Browser Console
To run JavaScript code, you need to open the browser console. Use the following shortcuts for common browsers:
- Google Chrome & Edge: press
Ctrl + Shift + J
(Windows/Linux) orCmd + Option + J
(Mac) - Firefox: press
Ctrl + Shift + K
(Windows/Linux) orCmd + Option + K
(Mac) - Safari: enable the
Developer Menu
in preferences, then pressCmd + Option + C
2. Paste and Run the Code
Copy and paste the following JavaScript code into the console and press Enter:
const els = document.querySelectorAll("a");
const links = Array.from(els).map(el => [
el.textContent.replace(/\s+/g, " ").trim(),
el.href
]);
let table = "<table><thead><tr><th>Name</th><th>Links</th></tr></thead><tbody>";
table += `${links.map(([name, link]) => `<tr><td>${name}</td><td><a href="${link}" target="_blank">${link}</a></td></tr>`).join("")}`;
table += "</tbody></table>";
const tab = window.open("");
tab.document.write(table);
3. View and Save the Extracted Links
After running the script, a new tab will open displaying a table with all links from the webpage. You can copy the links to Microsoft Excel or any other place.
This method is quick, effective, and works without any extensions. Enjoy.