HomeDigital MarketingPython, me and SEO

Python, me and SEO

In November I did not publish any guide wih SEO, it was a long time since I skipped a month. Unfortunately (for the blog) at that time I dedicated my evenings to learning new things , now I’ll tell you.

Every year I try to participate in various conferences on search marketing , useful opportunities for comparison with other professionals are rare and on these occasions I met brilliant people from whom I was able to get ideas and ideas. Why am I talking about events? Because for some years now I have heard more and more speech revolve around Python, every year the case histories multiply: a programming language with a simple syntax and with which it is possible to do fantastic things , the legends tell.

Today it seems that if you don’t know how to use Python, you are nobody. Paolo Dello Vicario was the first (from what I saw) who presented a case of data analysis done with Python. Very interesting, but I felt strong barriers to entry in learning to program in a new language.

The good thing is that I am curious by nature, I learned PHP and sifted through JavaScript for interest, just to understand what could be done, I created plugins for this site and nothing more. However, with Python it seemed a bit more complex to me, but I was wrong. I recently had an eye on a script by Alessio Nittoli that scans the PAA (People Also Ask) box in the Google SERP and graphically displays all the questions.

The People Also Ask box

I love these things and can’t do them with Python. I have to learn! I said to myself.

At the dawn of 40 I contacted 2 Python programmers, one was not enough for me: Luca Zomparelli (senior profile) and Enrico Cerri (junior profile). In this period I am dedicating 4 to 6 hours a week to private Python lessons, it was time that I was not so passionate about something new.

I bought a Raspberry Pi 4 (with a case for a serious person) to do all the necessary experiments, it is an excellent board to work with Python and given the low consumption it can remain on and working 24 / 24h.

Raspberry Pi 4 – 4 GB RAM and Anidees aluminum case

The lessons never overlap despite having two instructors: with Luca we see the theory, the syntax and we correct the exercises that I invent myself. With Enrico instead we practice and put my exercises online using Django and all the tools necessary to bring Python to the web world.

I will not become a developer, this is clear enough, but I will be able to take off some whims by programming myself small tools and I will learn new things.

Teaching lessons without putting into practice does little, especially in programming. I want to maximize these hours of learning so I’m busy doing exercises. I already had several application ideas in mind that would come in handy in my everyday work, so I started practicing developing these ideas.

Twitter auto poster

After the first lesson I developed a tool that, giving it a domain, performs these steps:

  1. Search and download sitemap.xml and extract individual post URLs.
  2. Exclude URLs I want to exclude from the list.
  3. He connects to Twitter and automatically starts posting an article every 2 hours, extracting the title tag from the URL and using it as the text of the tweet with SEO.
  4. When it finishes sharing the whole list, the script downloads the sitemap again and starts over with the updated list.
  5. If the script were to interrupt or the Raspberry should restart, the playlist has been saved in a csv file so the tool picks up exactly where it left off.

Twitter auto poster with Python

Cool isn’t it? I created my social media manager after a Python class, it took me 30 hours and lost a lot of sleep but I was fucking enthusiastic like I haven’t been in a long time .

EVE Milano Twitter App with Python

Slowly I begin to understand the enormous potential of this language and how to use it to save time .

I was thinking of making this tool public, publishing it online, however I believe that the interest is very low and I would end up using it only myself. In case anyone is interested let’s talk about it.

Keyword clusteryzer

After a few lessons I tried to develop a second idea I had in mind, that is a tool that can help me cluster long lists of keywords using the distribution of individual terms as a reference (you know URLsmatch ?). In short, the script reads a list of keywords and associates each category with the category, so that the aggregate data can then be analyzed.

As I always say, the first activity to perform in an SEO strategy is keyword analysis . This data-mining and analysis process is very long, cataloging large word lists can take dozens of hours of work. So why not take advantage of Python with SEO and my Raspberry to automate this task?

Said and (several hours later) done! I now have my own three tier clusterizer .

Python script to catalog keyword lists

Below is the export of the script in csv file:

Keyword cluster generated with Python

This script cataloged a list of 50,000 keywords for me in 31 minutes. In addition to being much faster than me, in the meantime I can do other things. But couldn’t I start studying Python earlier?

This tool will go online this weekend and will be available to everyone for free.

Super Google Suggest

The third idea I developed uses Google Suggest and is basically a data mining process to generate valuable long tails. I already have a tool that uses Google Suggest , but with Python you can do much more than just receive a few hundred terms … Python lends itself to scripting, just query Google cyclically with specific sequences of characters to obtain practically infinite lists of related keywords and long-tailed . How? Let’s see some ideas:

  • I loop the suggestions, that is: I look for the suggestions of xyz, then I look for the suggested suggestions in turn, and so on cyclically. With 3 or 4 loops you can easily extract over 500 terms in seconds.
  • I cyclically append a letter of the alphabet to my query, or better, I append two letters to get many long tails, ex:

    • Luxury hotels aa
    • Luxury hotel ab
    • Luxury hotel ac
    • Luxury hotel ad
  • I cyclically prepend two letters of the alphabet to my query, ex:
    • aa  Luxury hotel
    • ab  Luxury hotel
    • ac Luxury hotel
    • ad Luxury hotel
  • By chaining the three loops just shown it’s easy to extract tens of thousands of long-tails, but it takes several hours.

In short, working with a little ingenuity I managed to obtain a list with 35,000 long tail terms related to “Luxury hotel”. Ah, all while I was sleeping.

He scrapes while I sleep …

This tool will go online soon , I must first be able to move the calls to the client side to avoid server ban by Google.

Python comes in handy in my daily work, I can automate simple tasks that are time consuming . With Python, there are libraries to do thousands of tasks and import them in seconds. One of the application fields where Python is most exploited is data analysis. And Machine Learning, a subject. That I cannot yet talk about since I have no experience of it. I hope in the future to be able to understand and maybe develop some small ML functions.

SEO and Python?

As you can see with Python it is possible to do many things, where there is data. Where there is API, Python is at ease. I am not saying that for an SEO it is strictly necessary to know Python. I had talked about it in the article on the skills of an SEO , but I am convinced that knowing is better than not knowing, and this language can be useful and practical in everyday work.

An SEO works with a lot of data, but the data must be analyzed and interpreted otherwise they are useless. Data is not lacking today, we are inundated with data. If ever what is missing is time, so a tool that analyzes data and saves you time is interesting in my opinion, isn’t it?

Not sure where to start? The web is full of examples, you just have to decide which data you are interested in;)

  • You can automate the storage of Google Search Console data through the APIs. So as not to have the constraint of 16 months of historicity.
  • You can use the Google Ads APIs to download data or automate rules and behaviors.
  • You can use the WordPress API. For example, if you have a database. You can turn it into a WordPress site by POSTing every single entry in a few moments .
  • You can query Wikipedia through its API .

With Python the potential and possible developments are practically infinite, the limit is the imagination .

Pimp my Raspberry

In the end I’m a NERD geek and it’s easy for me to get carried away with useless gadgets… With this active heatsink, the Raspberry temperature never exceeds 60 ° even under constant effort. To see it certainly makes its pig effect.

Raspberry Pi 4 with active cooling GeekPi tower cooler

It must be said that the Raspberry Pi 4 doesn’t necessarily need an active heatsink. Even with a decent and properly mounted passive cooler the RB is not likely to throttle . Throttling is when the CPU temperature is so high that it has to slow down the clock rate. And this happens after 80 degrees on this specific card.



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments