Today, we will look into SEO differently, especially the first step, which is keyword research. We will not be using any keyword tool. We will create our own AI-powered tool to get the best results!
In this post, I will show you a new project I created: The Keyword Bomber Tool. It is free and open source, and you will get the full source code by the end of this post.
Not only that, I will also show you how you can turn this project into 3 income streams 💵 So buckle up and get ready for some magic!
What is keyword research?
Alright, let’s dive right into the heart of SEO: keyword research.
Imagine you’re a detective, and your mission is to find out exactly what words or phrases people are typing into search engines. That is simply Keyword research.
It’s the fundamental step in SEO, where you identify popular words and phrases people enter into search engines related to your business or content.
Why is this important?
By knowing these keywords, you can optimize your website and content to rank higher in the search engine, making it easier for those searching for your content to find you.
Without understanding what your potential visitors are searching for, you can’t effectively optimize your site or content.
The Keyword Bomber Method allows us to uncover hundreds of potential hidden keywords and ideas that we can use to rank our website higher on Search Engines, especially Google.
Google Auto Suggestions
Have you ever noticed how when you start typing something into Google, it begins to predict what you’re going to type next?
That’s Google Auto Suggestions at work! It reveals what other people have searched for when they typed the same initial words.
These suggestions are based on real searches by real people. This means they’re a goldmine of popular queries and phrases. Understanding these can give you a sneak peek into the minds of your potential visitors.
Automating with Python
With the “Keyword Bomber” method, we’re not passively looking for Google autosuggestions. With the power of Python and AI, we will automate the process of collecting these suggestions.
So, what we will do now is to connect Google Auto Suggestions with Python.
Let’s start first by understanding the concept behind our project.
If you open your browser now and paste this URL:
http://google.com/complete/search?output=toolbar&gl=US&q=Digital Marketing
You will see that you will get a list of keyword suggestions in XML format, as shown below:
Now, here is the trick: instead of “digital marketing” we will pass “digital marketing a“
Like this:
http://google.com/complete/search?output=toolbar&gl=US&q=Digital Marketing a
Take a look at the results:
You see what happened now! We got alphabet suggestions for the keyword with the letter “a.”
We can do this with the whole alphabet!
Then we can try something else, like adding “vs” after the keyword, so we search for “digital marketing vs“
Then we can add Questions like “what digital marketing“
and so on.
Here is a set of categories I collected that you can use to join with the target keyword:
"Questions": ["who", "what", "where", "when", "why", "how", "are"]
"Prepositions": ["can", "with", "for"]
"Alphabit": list("abcdefghijklmnopqrstuvwxyz")
"Comparisons": ["vs", "versus", "or"]
"Intent-Based": ["buy", "review", "price", "best", "top", "how to", "why to"]
"Time-Related": ["when", "schedule", "deadline", "today", "now", "latest"]
"Audience-Specific": ["for beginners", "for students"]
"Problem-Solving": ["solution", "issue", "error", "troubleshoot", "fix"]
"Feature-Specific": ["with video", "with images", "analytics", "tools"]
"Opinions/Reviews": ["review", "opinion", "rating"]
"Cost-Related": ["price", "cost", "budget", "cheap", "expensive", "value"]
"Trend-Based": ["trends", "new", "upcoming"]
There are many others, but I think this list is a very strong starting point for our project.
Ok, now we have the core idea for our project. Let’s automate the process with Python.
Don’t worry; I will give you the full source code later, and you can run it with a click. For now, follow this to understand how this project works. Maybe you can update it and make it more powerful.
Below is a Python function that takes a country and a keyword and returns a list of keywords:
async def get_suggestions_for_query_async(query,country): async with httpx.AsyncClient() as client: try: response = await client.get(f"http://google.com/complete/search?output=toolbar&gl={country}&q={query}") suggestions = [] if response.status_code == 200: root = ET.fromstring(response.content) for complete_suggestion in root.findall('CompleteSuggestion'): suggestion_element = complete_suggestion.find('suggestion') if suggestion_element is not None: data = suggestion_element.get('data').lower() suggestions.append(data) except Exception as e: #nothing error = e return suggestions
Now, you can loop through the categories I gave you before and start building a list of hundreds of keyword suggestions.
Powering Our Results with AI
After we collect a list of keyword ideas and suggestions, it is time to feed this data to AI, have it analyzed, and generate an SEO strategy based on the collected data.
Instead of asking ChatGPT to “Generate an SEO strategy for a site about digital marketing,” you will feed it a prompt like this one:
You are an expert in SEO and data-driven marketing strategies. You am familiar with analyzing keyword data, including metrics like search volume, paid competitors, SEO difficulty, and cost per click.
Using the provided [Keyword_data] categorized into various themes as follows:
Questions: Keywords starting with 'who', 'what', 'where', 'when', 'why', 'how', 'are'.
Prepositions: Keywords including 'can', 'with', 'for'.
Alphabet: Keywords beginning with each letter from A to Z.
Comparisons: Keywords containing 'vs', 'versus', 'or'.
Intent-Based: Keywords with 'buy', 'review', 'price', 'best', 'top', 'how to', 'why to'.
Time-Related: Keywords related to 'when', 'schedule', 'deadline', 'today', 'now', 'latest'.
Audience-Specific: Keywords like 'for beginners', 'for small businesses', 'for students', 'for professionals'.
Problem-Solving: Keywords around 'solution', 'issue', 'error', 'troubleshoot', 'fix'.
Feature-Specific: Keywords with 'with video', 'with images', 'analytics', 'tools', 'with example'.
Opinions/Reviews: Keywords including 'review', 'opinion', 'rating', 'feedback', 'testimonial'.
Cost-Related: Keywords about 'price', 'cost', 'budget', 'cheap', 'expensive', 'value'.
Trend-Based: Keywords like 'trends', 'new', 'upcoming'.
Please analyze these keyword suggestions and provide SEO strategy advice for each category. Focus on:
Content Strategy: Suggest types of content and approaches that could be effective for targeting keywords in each category.
Audience Engagement: Offer insights into how to engage different audience segments based on the keyword categories.
Competitor Analysis: Briefly discuss potential competitive landscapes for these keyword categories.
Long-Term SEO Planning: Provide ideas on incorporating these keywords into a broader SEO strategy, considering their categorical themes.
Provide a list of 7-10 bullet-point suggestions on how to use these keywords, highlighting unique opportunities and challenges they present.
[Keyword_data]: {KEYWORD_DATA}
I know it is a bit long, and you can see at the end that we are passing the keyword data to the prompt, but crafting the right prompts is how you can get the most out of AI and language models.
As we learned in Prompt Engineering, there is no such thing as the best prompt. We always try to optimize, tune, test, and evaluate to get the best results.
Anyway, the idea here is to pass this prompt to AI using OpenAI API in the same Python script. In this, we build an automation workflow. You just pass a keyword, and the script will find keywords, connect with OpenAI, generate the analysis and get you the final results.
This is the power of automation workflows, and it is exactly what I teach in my prompt engineering course. You will learn how to build any workflow to automate almost anything with the power of AI, Python, and Power Prompts.
Going back to our script, here is simply the function I used to connect my data and the prompt with AI:
async def suggestions_ai_analysis(keyword_data: str, api_key): max_retries = 5 for _ in range(max_retries): try: # Get Json Structure prompt = prompts.suggestion_keywords_analysis.format( KEYWORD_DATA=keyword_data ) return await llm.generate_response(prompt, LLM_MODEL, api_key) except Exception as e: print( f"Failed to generate analysis for suggestion keywords. Exception type: {type(e).__name__}, Message: {str(e)}" ) return ""
You can see that this function has keyword_data
as a parameter. This data will be chained in the prompt in this line:
prompt = prompts.suggestion_keywords_analysis.format( KEYWORD_DATA=keyword_data )
Then, the prompt will be passed to OpenAI with a function I created, generate_response
and get the results back.
Run The Project
In this section, I’ll guide you through the steps to get your project up and running.
1. Download the project
Below is the link to download the entire “Keyword Bomber” project.
2. Open with Your Favorite IDE
Once downloaded, extract the files and open the project with Visual Studio Code or any IDE you prefer.
3. Install the Requirements
Run the following commands in the terminal:
pip install streamlit asyncio pandas httpx requests openai
We still have one requirement, which is adding your OpenAI API Key in the app.py
script here:
#Set your Open AI API Key
API_KEY = "sk-XXX"
4. Running the Project in Terminal
Now, it’s time to bring your project to life. In the terminal, navigate to your project directory and run the following command:
python app.py
Running the UI
But what if you want a more visual, interactive experience?
That’s where Streamlit comes in. I’ve crafted a user-friendly UI for the “Keyword Bomber” tool. To test it, run this command in your terminal:
streamlit run app_ui.py
And the UI will open in your Browser:
Need Help?
If you encounter any issues or have questions, don’t fret. We are here to help you. Just join us on the forum.
Turn This Project Into 3 Income Streams!
We’ve built something amazing today – a powerful tool that automates and revolutionizes SEO research using Python and AI.
But why stop at just using it for your own SEO? It’s time to think bigger. Here’s how you can turn this project into not one, not two, but three streams of income!
1. Freelancing
There’s a massive demand for SEO and digital marketing services. Companies and individuals alike are constantly seeking ways to improve their online presence. And what you have is not just a service but an AI-powered full solution.
- Offer Customized SEO Services: Use your “Keyword Bomber” to offer keyword research, SEO strategy, and content planning services. Your ability to provide detailed, AI-driven insights will set you apart from the competition.
- Create Scripts: Some clients might want their own customized version of a keyword research tool. Use your skills to create and sell scripts or even offer to set up and maintain the tool for them for an ongoing fee.
If you want to learn how to do this from scratch, you can check out my Full Course: Become a Prompt Engineer: Go From Zero to Scripting AI Workflows!
This course will take you from zero to hero, with no prerequisites needed. Start by mastering the basics of prompt engineering, progress to Python scripting, and then learn to construct AI workflows with power prompts.
2. API Development
This project and similar ones have the potential to be API.
By turning it into an API and selling access on platforms like RapidAPI, as I do, you’re offering a valuable resource to developers and businesses.
- Develop an API: Package your “Keyword Bomber” script’s functionality into an API. Ensure it’s well-documented, reliable, and scalable.
- Monetize on API Marketplaces: Platforms like RapidAPI are where developers and companies look for APIs to enhance their applications. List your API there and set a pricing model that could include pay-per-use or subscription plans.
If you are interested in learning more about Building and Selling APIs, you can check out my full course here.
3. Online Tool
Finally, create an online tool with this script.
By integrating it with a user-friendly interface on a WordPress website, as I did with my Keyword Bomber tool, you can attract a wide range of users, from SEO professionals to bloggers and small business owners.
- Create a Subscription-Based or Points System Website: Develop a WordPress site where users can access your tool by subscribing or by buying points, as I do.
- Monetize Through Ads and Affiliates: Even if you offer the tool for free, you can monetize your site through ad spaces, affiliate marketing, or by providing premium services.
If you would like to learn more about how I turned my WordPress site into SaaS with the points system and how I am selling my tools here, you can check out this course: Turn WordPress into SaaS—Building The Points System!
It is a step-by-step guide, including plugins, tools, and code snippets that will help you save countless hours in building this system on your site.
Have fun!
Great stuff, sir, Thank You.
Although, I do have to say I personally have issues using terminal, and items like that.
I’m wondering what I would need to do to implement thru WordPress like this one
https://learnwithhasan.com/learn/wordpress-saas/.
I’ll dig into things and see later this weekend, but if you have a quick guide to apply in WP rather than through terminal, that Would be awesome~
Again, Thank You for the excellent, informative work.
The WordPress SaaS course has nothing to do with the terminal, thank you!
Hey, great idea. And I mean GREAT. Couple of things:
1. None of this works out of the box on Windows – Asyncio problems, streamlit problems related to the User context in which you’re running. Painful.
2. When I did eventually get it running by modifying the code to sidestep the asyncio problems, I found that “streamlit run ui.py” doesn’t work because…. ui.py is not in the project.
FYI, I know NOTHING about python.
Thanks again!
S Lid
you need to install the requirements. please join us on the forum for technical help
After installing the requirement and running this command this is what I get https://i.imgur.com/rXZm4VF.png
please post your questions on the forum so we can follow up properly
1- The command should be streamlit run app_ui.py
as there is no file called ui.py in the folder
2- I run it and show this error
https://i.imgur.com/E6wSEyJ.png
3- Ok let’s ignore all of the gui problem and want to run it in the terminal
so what to do after python app.py
I won’t call this as a guide
Hi Sala, learning requires some patience 🙂 you are right, I will fix the streamlit call. and please join us on the forum, we are more than happy to help. we can follow up properly there. when you run the app with python app.py, the script should run, if you see errors, please join the forum and share screenshots to help you
Nice work you are doing here,but I really need your help to understand this better.Thanks
Join us on the forum 🙂
Pingback: Build a No-Code AI System for Topic & Keyword Research
Pingback: Develop a Keyword Research Tool With C# & Python
Pingback: How To Use AI in Marketing (11 Practical Examples) - LearnWithHasan