Vollständiges Transkript von „Python Leverage for Content Creators: Using ChatGPT and APIs to Generate SEO optimized Blog Posts“. Klicke auf einen Zeitstempel, um das Video an dieser Stelle zu öffnen. Du brauchst ein anderes Video? Nutze den YouTube-Transkript-Generator.
0:01 Hey guys, I hope you doing all right. Today I'm going to introduce you to one of my projects where I'm using OpenAI, JetGPT, Python, the Unsplash Media Library and WordPress to generate blog posts out of my CLI. The project is already on GitHub. it's available to download and I'm going to introduce you a little bit more about the code and the structure of it so it is basically split into several directories we have one
0:50 database directory this is basically just there for for the tracking of our blog posts and the costs of our generated blog posts so that we have everything sorted then some basic tests for people who download and try the tool we test our config the tests to the open ai api and our wordpress jwt token which you have to install as a plugin like an authentication plugin then we have to a folder or directory for the utilities we want to cache
1:38 our jwt token we want to parse our config we integrated or i integrated the the direct connection to the google search console so that if you publish your blog post it will directly be updated at the google search console so the the advantage is that your blog post is directly indexed into google and then we have the temporary file this is used to to upload the pictures from unsplash the core of the project is basically only the generate blog post the people also ask the unsplash and the wordpress controller but now let's dive deeper
2:27 into the code as I told you I have the several directories I'm going to start with the heart basically well let's say I start from the CLI part we can start our CLI and then basically by running Python CLI.py it will automatically start this function from there on we can then or it will then pass all the the arguments or options which we define in in the command line and
3:17 basically create our blog post so we have several options we can plan our release we have the option to to to pass in a category the default is here number two because that's the default category of WordPress once you you start your your engine or your instance then you can give block tags you can make them sticky that's the option to directly send it to the search console we can add a picture and we have the automated schema markup fhq which is generated by
4:05 the people also ask so it basically scrapes google all the the um the questions from the also people also ask get answered by the openai gpt api and then added to our block so um yeah basically this this class gets instantiated these are all the the attributes um it's in german by the way so if you want it in english you have to change that to generate the table of contents um yeah i use it for a german block therefore uh it's in german the prompts
4:50 um yeah some properties so this is basically only for my database to track okay my my blog post has 5000 words for example as i said it also tracks the costs um and there yeah we we can also generate sources generate content and um translate it then into a um HTML forward to to basically Yeah, I have the HTML In the WordPress blog Let's dig into the generate Method it basically goes
5:38 over all the degenerated Points of the table of content and writes the content Afterwards we merge it in the Here we merge it here. We pass the Keyword arguments and create the merged HTML Yes, this is also done in another there we go generate html this is done by by py
6:25 pandoc it basically converts our markdown to html so we send it to our wordpress instance um i also tell them to to use nofollow links instead of dofollow because we we as i said we generate our sources and then i don't want to place them as a do following because i don't know if the ai did a correct job so it's no follow and i don't have to think about that um the clean numerisch geordnet is also sorry for my naming uh it's it's a function which which um
7:13 what does it do it basically creates a cleaned yeah it basically cleans the sources so they don't start with one two three four five um yeah what else is interesting the people also ask as i said it scrapes google which is done by the people also ask module um Then we want to have it in schema. As I said, this is important SEO aspect to have a nice SEO markup or
8:03 schema markup. And this is done by basically all of that. What it does, it just adds this at the beginning and then goes over all the answers and puts it into a nice markup the unsplash.py is is the the class to or like the unsplash is the class to to access the unsplash api and get a picture for for our wordpress blog post um yeah it searches by our keyword so if we if we give
8:48 the title keyword blog post about Python coding it will get the first the first picture and uses it and this can sometimes be wrong but to make it easy I just used it like this yeah our our WordPress controller is basically um yeah the the heart of the connection between the script and wordpress it it initializes verifies with the token
9:34 and you can get all the posts we have you can create a post you can upload the media and and yeah we also have a data class which represents our blog post this is just the representation of the blog post as it is given in the wordpress api and yeah this is basically already descript we can go into the cash token um yeah we use a decorator so we we can use the time we want to cache it here but the jwt token plugin we install
10:20 on our wordpress blog caches by default so we use that the config parse is just to parse our config the google search console is the class to to yeah to interact with our google search console temporary file as i said is to to create a temporary file on our system and then send it to the wordpress blog we can also have a look into the database so it has only the one table
11:08 where we track the the title release the generated date the word count the costs in dollars so that we have a little overview of what we generated and we can also say okay we generated this on on day x how is the outcome on the ranking in google on day y for example then we also have the make file which is just um yeah if you execute the make file you can basically save two commands which you have to execute other than that so it basically does the linting for us where we use flake 8 and the tests and yeah that's
11:56 basically it i can also show you how to run it i use my cli configuration but we can also use it here so we say python tree then as i said cli.py i hope it works now because i haven't used it for a while i just came up by the id to make a video about it um and we say fire no such file of course okay yeah it is not working as i believe it has to be something with the Python 3.11 but let's try to run it here
12:46 it does look better not sure if my API keys are still working though but I'm happy to support you setting it up you should be able to to set it up by yourself with the readme it's quite quite good I would say so this is just a custom CSS stuff you you don't need to do that though you need to to edit the HT access file for the JWT of plugin I explained how it works here if you're using a
13:35 docker container you have to bash into the um the container and then do some stuff here and you also have to change the wp config file and you have to set up the search console this is explained in my blog it's probably in german i believe it's in german but you can translate it and i definitely recommend it to you to use the API because it indexes way faster other than that you only have to fill your config.ini file run make test if that runs you should be good to go and then as I said
14:21 python tree or python cli.py if you pass in the help argument you will see what you can do and here I give a little example feel free to contribute if you find a bug or anything else yeah and you obviously have to install the the requirements wire pip i hope you enjoyed the video i'm not sure if i went over all the code and explanation a little bit too fast please let me know in the comments below i'm happy to support you and give you better explanation in detail I'm also happy if you leave a follow and
15:09 I also want to announce that in my next videos I might introduce you to the the next step I went from blogging with AI I took this as a base like a proof of concept then I build in little a little MVP for myself with a graphical user interface or like app and from there on I went one step further and released a beta version of Virginie you can check it out app.virginie.de it's a s a a s tool yeah sas tool
15:59 where you can basically synchronize all your blocks to one central platform and generate all the content you want to create i can show it to you there we go it's just registered test we use this as a password it's just a test hello hello tree we log in as you can see and from there on I hope you can
16:46 find out how it works yourself I'm also happy to help you and I'll see you in the next video bye bye