[Step-by-Step Guide] Find keywords, create and publish 150 articles to wordpress site in less than 30 minutes using GPTChat and Python/Google Colab

Did you rank for any keyword ? how many articles and traffic just now ? Appreciated your effort to enrich our forum. Thanks a lot.
Now I have see one keyword on 3rd page. It just started to get indexes. Also I have found that adding pictures increases indexing significantly so far.


Just replace last paragraph of the code because I added one comma to many:

Code:
    #now we post to out wordpres site
    try:
        the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category,
the_image_id
)
        the_link = the_response['guid']['rendered']
        print("the_link",the_link,"word count",len(gptchat_article.split()),"the_title:",title)
    except Exception as err:
        print("we have an error",err)

Maybe it even make sense to add more than one picture for some niches, and scrape a bunch of youtube video urls in advance, put them to a file and then randomly add to posts.
 
Thanks for this write-up. I ran into a couple of issues, but was able to work it out pretty easily. For those who might run into them as well: the biggest issue I had was allowing an application password. I was using a testing site that doesn't have HTTPS and the application password wasn't available.

Other than that, things are pretty well laid out! Thanks!
 
Can free chatgpt api do this work , or do I know to pay for the plus version
 
This script uses GPT-Chat via API, there is a 5 usd credit free trial for 3 months from the date you sign up. So no need for paid account, before you spend 5 usd trial.
 
Thanks for this write-up. I ran into a couple of issues, but was able to work it out pretty easily. For those who might run into them as well: the biggest issue I had was allowing an application password. I was using a testing site that doesn't have HTTPS and the application password wasn't available.

Other than that, things are pretty well laid out! Thanks!

You are welcome, I did not know about non https sites, but I guess most people use https. Good to know. Maybe even older versions of WP do not have app. password as well.
 
Last edited:
I had first post edited with article + image posted. Seem like indexing is better if you add images.
 
Great article but I'm getting this error:
we are writing post # 0 , using keyword: Ahrefs
we have an error Expecting value: line 1 column 1 (char 0)

Any help gratefully appreciated.
 
replace this:
Code:
    #now we post to out wordpres site
    try:
        the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category
,the_image_id
)
        the_link = the_response['guid']['rendered']
        print("the_link",the_link,"word count",len(gptchat_article.split()),"the_title:",title)
    except Exception as err:
        print("we have an error",err)

with this:

Code:
    #now we post to out wordpres site
    import traceback
    try:
        the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category
,the_image_id
)
        the_link = the_response['guid']['rendered']
        print("the_link",the_link,"word count",len(gptchat_article.split()),"the_title:",title)
    except Exception as exc:
        traceback.print_exception(exc)

and let me know what do you get
 
replace this:
Code:
    #now we post to out wordpres site
    try:
        the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category
,the_image_id
)
        the_link = the_response['guid']['rendered']
        print("the_link",the_link,"word count",len(gptchat_article.split()),"the_title:",title)
    except Exception as err:
        print("we have an error",err)

with this:

Code:
    #now we post to out wordpres site
    import traceback
    try:
        the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category
,the_image_id
)
        the_link = the_response['guid']['rendered']
        print("the_link",the_link,"word count",len(gptchat_article.split()),"the_title:",title)
    except Exception as exc:
        traceback.print_exception(exc)

and let me know what do you get
Output was:
we are writing post # 0 , using keyword: Ahrefs
Traceback (most recent call last):
File "<ipython-input-19-0eca88818836>", line 82, in <cell line: 25>
the_link = the_response['guid']['rendered']
KeyError: 'guid'
 
Output was:
we are writing post # 0 , using keyword: Ahrefs
Traceback (most recent call last):
File "<ipython-input-19-0eca88818836>", line 82, in <cell line: 25>
the_link = the_response['guid']['rendered']
KeyError: 'guid'
Disregard, I found the error. Was using the Base64 password instead of the app password and letting the script do the work.
 
Under what circumstance would you have remove_ai_detection="no" wouldn't it always want to be "yes"?
 
Hi, thank you for your efforts and I am very sorry, If I am interrupting you!
I tried the script, but used the old version (without an image added)
It gave me the following error:
we are writing post # 0 , using keyword: Ahrefs
we have an error Expecting value: line 1 column 1 (char 0)
Then, I used your advice and replaced the following part
#now we post to out wordpres site
try:
the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category
)
the_link = the_response['guid']['rendered']
print("the_link",the_link,"word count",len(gptchat_article.split()),"the_title:",title)
except Exception as err:
print("we have an error",err)
with this:
#now we post to out wordpres site
import traceback
try:
the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category)
the_link = the_response['guid']['rendered']
print("the_link",the_link,"word count",len(gptchat_article.split()),"the_title:",title)
except Exception as exc:
traceback.print_exception(exc)

Please note that I removed the image_id that was next to wordpress_category because it gave an an error image_id isn't defined because I don't use the image version.

Here is the error I got:
we are writing post # 1 , using keyword: can raccoons swim

Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<ipython-input-15-8653686fa46d>", line 46, in <cell line: 20>
the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category)
File "<ipython-input-3-0d1327361feb>", line 29, in make_post
return response.json()
File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

What are the problem?

Thanks in advance!
 
@ahmedtarek8572

1) Maybe username/password are wrong. username is wordpress main username, and password is application password


2)
@please note that I removed the image_id that was next to wordpress_category because it gave an an error image_id isn't defined because I don't use the image version.

You cannot mix these versions, you can use either 2 cells that do not add image (above) or 2 cells that do add images (bellow).


Try this and let me know.
 
@ahmedtarek8572

1) Maybe username/password are wrong. username is wordpress main username, and password is application password


2)
@please note that I removed the image_id that was next to wordpress_category because it gave an an error image_id isn't defined because I don't use the image version.

You cannot mix these versions, you can use either 2 cells that do not add image (above) or 2 cells that do add images (bellow).


Try this and let me know.
Thanks for the quick reply!
I removed the whole note book and created a new one and only used the old version. I double checked that everything is correct, but I still get this error:
we are writing post # 11 , using keyword: ahrefs
we have an error Expecting value: line 1 column 1 (char 0)




 
I replaced the last paragraph with this, as a way of helping you, identify the problem:
#now we post to out wordpres site
import traceback
try:
the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category)
the_link = the_response['guid']['rendered']
print("the_link",the_link,"word count",len(gptchat_article.split()),"the_title:",title)
except Exception as exc:
traceback.print_exception(exc)
This is what I got:
we are writing post # 11 , using keyword: what can raccoons eat

Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<ipython-input-11-5802fad0e7c4>", line 43, in <cell line: 20>
the_response = make_post(title,gptchat_article,your_user,your_password,your_site,wordpress_category)
File "<ipython-input-7-d655ddefbd52>", line 29, in make_post
return response.json()
File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char

Thanks in advance!
 
Check username/password of WordPress - this is likely the cause. I has to be application password and wordpress username.
 
I enjoy reading this post. Google colab keep giving error. Who else notice this.
 
Back
Top