How to get the number of Google+ Plus with Python

SEO metrics – SEO Likes

Among the SEO metrics it is often useful to know how many Plus are recognized for a particular site, or in more depth for a particular page that has been linked (either by the person concerned, but also by others) in some posts on Google+. Often the popularity of a page, or rather its appreciation, may be a very good indicator, if not a metric SEO, to know the success or failure of a campaign or a particular post.

SEOLIB – a useful library for SEO

Python is a programming language that lends itself well to data analysis. Moreover, the ease with which you can write a script and use it as a great tool for doing SEO investigations, makes it a great tool for anyone who carries out an activity of webmastering or marketing surveys. Python is a very useful language in this regard, because of the extensive number and variety of libraries that allow you to apply it in many areas. In PyPI repository (where available all the Python libraries) there is a library that provides a number of useful tools for SEO. This library is called seolib.

To install it on your computer, you have to write the following command from a command line:

pip install seolib

Then once you have installed the seolib package, you can import the module directly within a Python session.

import seolib

You can import the seolib module within the code too, if you need to perform more complex tasks.

How to get the Google+ Plus with seolib

To obtain the number of Google+ Plus assigned to particular site, the seolib library provides the get_google_plus () function that takes one argument, the URL of the site you want to analyze:

import seolib as seo

plus = seo.get_google_plus('https://www.meccanismocomplesso.org')
print plus  # for Python 2.7  ,on Python 3.x use print(plus)

if you execute the code you will get the number of plus assigned to the Meccanismo Complesso web site.

88

But you might also be interested in the number of plus assigned to a particular page of your site, in this case, you have to extend the URL passed as an argument including the whole URL of the page

likes = seo.get_google_plus('https://www.meccanismocomplesso.org/python')

Conclusions

If you are interested in more information about the seolib library, and its functions, I recommend you to read the official documentation (see here). Otherwise you will find more information and tutorials within the Python section of the Meccanismo Complesso site, in particular looking for the SEO & Webmastering (see here).[:]

Leave a Reply