jazzywp-logo-600x300white_1
Hand holding wooden board written with text website URL on a blue background.

Extract URLs from Google’s Web SERPs – 2024 Bookmarklet

Sometimes, we need to quickly extract a list of URLs from a Google web search, often for audits or pre-checks to see what Google has indexed. While there are tools available for this task, sometimes a quick analysis is needed. In such cases, a bookmarklet script like the one below can be incredibly useful.

The following code is an AI-enhanced version of the original script found on Chris Ains’s SEO Tools. This bookmarklet allows you to extract URLs directly from Google search results (or any page for that matter), making it easy to gather and analyze the data.

The code below performs a couple of validations as follows:

  1. It removes any URLs from the extracted list that contain google.com.
  2. It also eliminates any rows with empty URLs.
javascript: (function() {
    var pageAnchors = document.getElementsByTagName('a');
    var output = '<table id="extractedLinks"><tr><th>ID</th><th>Link</th><th>Anchor Text</th></tr>';
    var validLinkCount = 0;
    for (var i = 0; i < pageAnchors.length; i++) {
        if (pageAnchors[i].href && pageAnchors[i].href.trim() && !pageAnchors[i].href.includes('google.com')) {
            validLinkCount++;
            output += '<tr><td>' + validLinkCount + '</td><td><a href="' + pageAnchors[i].href + '">' + pageAnchors[i].href + '</td><td>' + pageAnchors[i].textContent.trim() + '</td></tr>';
        }
    }
    output += '</table>';
    var newWindow = window.open('about:blank', 'Extracted Links');
    newWindow.document.write(output);
    newWindow.document.close();
})();

How to create your bookmarklet.

  1. Enable ‘Show bookarmks bar’ in Chrome.
  2. Create a placeholder bookmark. eg: visit Google.com and drop the page in the bookmarks bar.
  3. Edit the bookmark URL and paste the code from above.

How to use the URL extractor bookmarklet

  1. Search a domain for indexed pages. eg: site:https://jazzywp.com
  2. Click the bookmarklet.
  3. A new tab will open with the extracted links.

Hope this helps! Once you’ve extracted the URLs, simply select all, copy, and paste them into a spreadsheet, and you should be good to go.

Share:

Facebook
Twitter
Pinterest
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *


Skip to content