Using ChatGPT to Build Python SEO Scripts

ChatGPT has shaken up the world to its core. it all happened so fast. Among all the brilliant things one can accomplish using ChatGPT, I tested it to build Python Scripts for SEO.

And it worked! 🤯

I always wanted to speed up processes & automate stuff using Python for SEO.

In this article, I will walk you through some of the Python scripts I have built using ChatGPT which are helping me with SEO Processes.

1. Reverse DNS Lookup at Scale

ReverseDNSLookupAtScale-Replit Python

Use case:

This script can help you verify search engine bots like Google Bot, Bing Bot etc.

The traditional way of doing Reverse DNS Lookup is via command prompt in Windows using nslookup command.

But this Python script helps you do this at scale. All you have to do is paste the IP Addresses in a txt file & run the code. The output tells you which of those IPs are from which search engines.

Here is Replit to access the code

2. Find Internal Links Missing from Google Rendered HTML

MissingInlinksFromGoogleRenderedHTML-Replit python

Use case:

This helps you identify internal link rendering issues faster.

Imagine you implemented site-wide internal linking for your client’s website using logic & internal linking widgets that are contextual too. But what if plenty of those internal links aren’t getting rendered in Google Rendered HTML?

That is what this script helps you identify. All you have to do is upload txt files.

One is view-source HTML txt file and another is Google rendered HTML code txt file. You can get Google-rendered HTML code from Rich results test or Google Search Console Inspect URL. 

Now this Python script compares the two txt files and in output shares those links that weren’t found in Google Rendered HTML txt file.

And as a result you end up saving a lot of time instead of having to go through the two codes manually & search the link with ctrl + F command.

Here is Replit to access the code

3. Find Preload Links for a URL

preload_links-csv-PreloadLinksFinder-Replit

Want to find out what all links are preloaded on a URL?

One way is to go through view-source and use ctrl + F command to search every preload URLs & record them in a notepad.

Or you can simply use Python to get all those preload links recorded in a CSV export which you can then download as well.

Here is the link to Replit to access the code.

4. Find Deferred Scripts

Find defer scripts

We defer scripts to improve site speed & sometimes deferring scripts can also cause tracking or rendering issues.

I generated this Python code that helps me find Deferred Scripts instantaneously.

At once in output I get all the scripts that are deferred, now I can manually skim through them & determine which should or shouldn’t be deferred.

Here is the link to Replit to access the code

5. Find If Exact Match Anchor is internally linking to more than 1 Page

FindExactMatchAnchorsLinking-1Page-Replit

Internal Link Audit can be tiresome work.

What if your task is to check on your Screaming Frog Inlinks report to which exact match anchors are linking to more than 1 page? Now that’s a lot of spreadsheets formula, filtering that you will have to go through.

But using this Python Script you can finish that task within minutes.

All you need is one inlinks export from Screaming Frog which should have the following columns source_url, target_url, anchor_text, follow_status, http_status

And the output will tell you about exact match anchors that are linking to more than 1 unique page & which those pages are.

Now this is a massive time saver.

Here is the link to Replit to access the code.

That’s it! I have built 5 Python Scripts so far which are helping me with faster SEO Processes. I will build more & update them here as I build more 😃

Keep Prompting!

ChatGPT Logo image source: https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/ChatGPT_logo.svg/2048px-ChatGPT_logo.svg.png

Leave a Comment