[METHOD] Make Your Own PAA Site With OpenAI - Complete Tutorial + FREE Python Script

How long does the script take to actually write the article/generate the output.csv file? (Obviously, it varies on prompt, etc. but ballpark)

Probably 30-40 seconds per article. I haven’t really checked tbh. I let it run in the background.
 
No need to waste money on buying PAA sites. You can make your own PAA site with hundreds of posts in a few hours.

Here's an easy tutorial and python script to make your own PAA site.

I don't like combining multiple PAA questions in one post so tutorial will show you how to create an article for each PAA question.

The only thing you'll need to refine is the prompt you use to create the content with OpenAI. I've included a very basic prompt. The output with this prompt is not going to be great. The output may even be too short to be usable.

You'll need to come up with your own prompts that are tailored for your niche.

DO NOT skip this step.

Prompts are the most important part of the entire process. Take some time and come up with a great prompt that'll produce high quality content.




Step 1: Select a niche

I recommend selecting a sub-niche within a broader niche. Working with smaller niches is much easier and you can build topical authority and rank quickly. For this tutorial, I'm going to use "Yerba Mate" as an example.

If this is your first time, I recommend selecting a super small niche like the one in the example.

Step 2: SEO Minion

Step 2 is straight forward. Use a VPN server in your target country, Google the main head term and scrape the PAA using the SEO Minion Chrome extension. You can use as many levels as you like. I'm using 8 levels for this example.

Step 3: Remove Duplicates

Use Excel/Numbers/Google Sheets to remove the duplicate PAAs. SEO Minion doesn't remove the duplicates so it has to be done manually. Also, make sure that all the PAA's are related to the topic. Sometimes, the PAA's have no relation to the topic. I suggest taking the time and manually going through the questions. Remove anything that isn't relevant.

Step 4: Prepare The CSV

We need to prepare the CSV for the script. It's pretty easy to do.

This is the output from SEO Minion:

View attachment 239045


Delete all the columns except PAA Title and Text. Rename PAA title to topic. Rename Text to context.

This is how the final CSV should look:

View attachment 239046

Rename the file as "input.csv".

Step 5: Use OpenAI to Generate Content

You're now ready to generate content using the OpenAI API. You'll need to use your OpenAI API key.

Here's the Python code you need to use:

Code:
import openai
import pandas as pd

df = pd.read_csv("input.csv")

# Set OpenAI API key
openai.api_key = "YOUR_API_KEY"

results = []

for index, row in df.iterrows():
 
    prompt = f"Please write a detailed article about {row['topic']}. Use this information to write the article: {row['context']}"
    response = openai.Completion.create(engine="text-davinci-003", prompt=prompt, temperature=0.7,max_tokens=2048,top_p=0.5)
    results.append([row['topic'], response.choices[0].text])

output_df = pd.DataFrame(results, columns = ['Topic', 'Generated Text'])

output_df.to_csv('output.csv', index=False)

In its basic form, the prompt will use the PAA answer as context to write the article. Assuming that the PAA answer that Google shows is accurate, the output generated using that as context should generate more accurate content.

Once again, YOU NEED TO CHANGE THE PROMPT. Please don't use this prompt because the output will be pathetic and short. The variable for the topic is {row['topic']} and the context is {row['context']}. Use these in your own prompt any way you see fit.

You need to customize your prompts for your specific niche. Ideally, you'd want custom prompts for each article but that takes too long when you're creating bulk content.

The output will be saved as a CSV.

Step 6: Use WP All Import

Use the WP All Import plugin to upload the content to your site. There are several tutorials that go over how you can do that. You can use some plugins for images etc.




That's pretty much it. It's super easy to get started. There are several ways to improve the output you get from OpenAI but I'm not going to get into that here.

You can also use this script for other types of content or for inserting researched data into a prompt.

Hello,

I improved your script:

1. added a cache so that downloaded responses do not "disappear" when an error pops up (e.g. API stops responding) the script creates an additional working file.
2. I added a progress bar that also calculates the estimated time.

# Importuj biblioteki
import openai
import pandas as pd
import pickle
from tqdm import tqdm

# Wczytaj plik CSV
df = pd.read_csv("input.csv")

# Ustaw klucz API OpenAI
openai.api_key = "apikey"

# Utwórz pustą listę na wyniki
results = []

# Próbuj wczytać wyniki z pliku cache, jeśli istnieje
try:
with open("results_cache.pkl", "rb") as f:
results = pickle.load(f)
print("Wczytano dane z cache.")
except (FileNotFoundError, EOFError):
print("Brak danych w cache.")
pass

# Pobierz indeks ostatnio pobranego wiersza
last_index = -1
if len(results) > 0:
last_index = results[-1][0]

# Implementacja pętli for i paska postępu
for index, row in tqdm(df[last_index+1:].iterrows(), total=len(df[last_index+1:])):
try:
# Określ tekst zapytania dla OpenAI
prompt = f"Please write a detailed article about {row['topic']} Use this information to write the article: {row['context']}."

# Wywołaj usługę OpenAI
response = openai.Completion.create(engine="text-davinci-003", prompt=prompt, temperature=0.7, max_tokens=3548, top_p=0.5)

# Dodaj odpowiedź do listy wyników
results.append([index, row['topic'], response.choices[0].text])

# Zapisz wyniki do pliku cache co kilka wierszy
if index % 5 == 0:
with open("results_cache.pkl", "wb") as f:
pickle.dump(results, f)
except Exception as e:
print("Wystąpił błąd:", e)
break

# Utwórz DataFrame z wynikami
output_df = pd.DataFrame(results, columns = ['Index', 'Topic', 'Generated Text'])

# Zapisz wyniki do pliku CSV
output_df.to_csv('output.csv', index=False)

cheers :)
 
Last edited:
Hello,

I improved your script:

1. added a cache so that downloaded responses do not "disappear" when an error pops up (e.g. API stops responding) the script creates an additional working file.
2. I added a progress bar that also calculates the estimated time.



cheers :)
Great! what we need now is to have it ad H2s to the spreadsheet and another script to expand all the H2s after you correct them.
 
Hello,

I improved your script:

1. added a cache so that downloaded responses do not "disappear" when an error pops up (e.g. API stops responding) the script creates an additional working file.
2. I added a progress bar that also calculates the estimated time.



cheers :)

That’s awesome. Thanks a lot.

Great! what we need now is to have it ad H2s to the spreadsheet and another script to expand all the H2s after you correct them.

You can get a complete article with H2’s etc with a prompt.

You can also add an additional step to first make an outline and then expand on it. But you may have issues with tone and repetition unless you cater for it.
 
That’s awesome. Thanks a lot.



You can get a complete article with H2’s etc with a prompt.

You can also add an additional step to first make an outline and then expand on it. But you may have issues with tone and repetition unless you cater for it.
Exactly, that is why I said to put it in the spreadsheet, after you review the headings, use another script to expand them. Thanks,
 
This post was created a little over 2 weeks ago. Has anyone gotten results from the generated blogs?
 
Exactly, that is why I said to put it in the spreadsheet, after you review the headings, use another script to expand them. Thanks,

Give it a shot. Sometimes it gets very repetitive.

Depends on the keywords

Since it doesn’t have the context of the previously generated content for the article, it tends to be more repetitive


This post was created a little over 2 weeks ago. Has anyone gotten results from the generated blogs?

It’s highly unlikely that new sites will see any results for 6 months. I’d recommend starting 8-10 sites in different niches, scheduling content to post over one year and forgetting about them.

A couple of them may turn out to be winners. Focus on those, discard the rest and repeat.

i have 100 posts published but still indexing is slow, will start publishing 50 posts/day and update you here about the results.

Yeah indexing has been slow lately.
 
Hello,

I improved your script:

1. added a cache so that downloaded responses do not "disappear" when an error pops up (e.g. API stops responding) the script creates an additional working file.
2. I added a progress bar that also calculates the estimated time.



cheers :)
Awesome, thankyou for this!
 
I started PAA in August/September 2022 and got 3.5K organic traffic in 3 months with around 10K posts. 90% of my traffic was from USA.. I even got accepted by Ezoic and earned 5$ in November.. I was on a good road but one day everything was deleted and i couldn't even enter my website... And that's how i gave up from this :D

Although i think that this is a great method for someone who knows how to code and has more experience in managing more websites. Because if i had this result with only 1 website in 3 months imagine what would happen if someone manages 100 websites.. Because if you have the proper bot you can upload 10k posts daily..
 
I started PAA in August/September 2022 and got 3.5K organic traffic in 3 months with around 10K posts. 90% of my traffic was from USA.. I even got accepted by Ezoic and earned 5$ in November.. I was on a good road but one day everything was deleted and i couldn't even enter my website... And that's how i gave up from this :D

Although i think that this is a great method for someone who knows how to code and has more experience in managing more websites. Because if i had this result with only 1 website in 3 months imagine what would happen if someone manages 100 websites.. Because if you have the proper bot you can upload 10k posts daily..

You shouldn't have given up. You can always start a new site. At this stage, it's almost free to start a site with AI content.
 
I have update the code below to make long form content. This post got my wheels spinning, and I finally found out how to get the API to elaborate on the initial response. Update {Sections} to however many headings you want in your blog post.

Still recommend you coming up with your personal prompt when you ask the API to write the section itself.

Enjoy.

@warriorsam53 thanks so much for this eye opening content.

so many error for this pal, could you solve it? thank you in advance
 
so many error for this pal, could you solve it? thank you in advance
import openai
import pandas as pd
import re
# %%

df = pd.read_excel("input.xlsx")
# Set OpenAI API key
openai.api_key = "API KEY"
blog_posts = []
paragraphs = 6
article = ""
for index, row in df.iterrows():
title = row['Topic']
prompt = f"write a {paragraphs} part blog outline on {row['Topic']}"
response = openai.Completion.create(engine="text-davinci-003", prompt=prompt, temperature=0.7,max_tokens=2048,top_p=0.5)
response_text = response['choices'][0]['text']
blog_posts.append([title, response_text])


# %%
blog_posts_df = pd.DataFrame(blog_posts, columns=['Title', 'Outline'])
# %%
article = []
for index, row in blog_posts_df.iterrows():
for i in range(1, paragraphs+1):
prompt = f'Write the blog section for section {i}. Make each bullet point a heading but make them more of a natural feel as if they are blog post headings. Relate each bullet point to the title and write each section like a long form essay. Do not write an introductary paragraph unless one of the bullet points calls for it and do not use the heading ""Conclusion""'
title = row['Title']
response = openai.Completion.create(engine="text-davinci-003", prompt= row['Outline'] + prompt, temperature=0.7,max_tokens=2048,top_p=0.5)
response_text = response['choices'][0]['text']
article.append([title, response_text])



# %%
articles_df = pd.DataFrame(article, columns=['Title', 'Article'])
articles_df = articles_df.groupby('Title')['Article'].apply(' '.join).reset_index()
# %%
articles_df.to_excel('articles.xlsx')


you shouldn't have received any errors in running the code if the proper libraries are imported, however, this is an improved version of the code. If you're receiving errors, then you likely didn't install the proper libraries or didn't get your API Key.
 
Last edited:
Back
Top