MACRO: Get The Word Count, Keyword Density, and Content Outline Of All The Google Search Results

As I'm a blogger, I tend to manually research the top 10 results for the keyword I'm willing to rank for. As I got my hands on Keyboard Maestro, I thought of creating a macro, that would display the word count of the top 10 URLs, keyword density, and also all the headings inside those web pages.

For this plugin to work, you need to have SERP.txt under Keyboard Maestro folder in your Applications folder. You also need to add a free Mercury web parser API in the macro. The actions that need your attention are highlighted in red inside the macro.

This macro does four things.

  1. Extract all URLs in Google search results (using @JMichaelTX's [WEB] Get URLs from Google Search Results [Example])

  2. Get word count of the content in the webpages and paste it in the txt file(using Mercury web parser API - https://mercury.postlight.com/web-parser/

  3. Ask for keyword input from you. Displays the number of occurrences of the keyword in the webpages along with the keyword density.

  4. Get all the headings from the output received from the web parser API request (h1 to h6), and paste it in the txt file.

Here is the macro.

SERP Headings, Word Count and Keyword Density Scrape.kmmacros (40.0 KB)

This macro will demonstrate you.

  1. Getting all URLs from Google Search Results
  2. Getting only the main content/article content out of the webpages
  3. Getting the word count of the URLs.
  4. Regex for matching the content inside any header tags.
  5. Looping through each URL in a list of URLs using Regex matching and performing actions on them.

In case if you want to get the word count and headings of a single copied URL, here it is.
Scrape Single URL.kmmacros (9.7 KB)

In case, if you need only word count of all the Google Search results, How to get the word count of a list of URLs?

Note that, depending upon the Mercury Web Parser and the web page structure, the scraping of headings have a success rate of like 90%. Some URLs may be skipped while scraping search results for headings. But the word count works on all URLs and has 100% success rate

1 Like