Imagine the following scenario - you want to promote a new product and you and your team have made the decision to step into influencer marketing.
Earlier, marketers have talked about "WOM" or "word of mouth". Even before discovering the concept of word-of-mouth marketing, it was known that people would trust a rather familiar person and not a stranger.
Honestly, influencer marketing needs no further introduction. Nowadays, there is a multitude of different types of influencers - fitness, beauty, mindfulness, etc... The list is basically endless.
Right now, a person that has discovered a niche for themselves to create content. Doing so they influence opinions on a certain topic and may get a brand deal.
What we will do in this blog is use Python to create an online database that stores all the influencers within our niche of interest. There are a lot of similar services online, which are quite expensive. So, we decided to create our own that will help us find the best possible influencer.
To create a database full of crucial information, we need to answer the following question first - "What makes a good influencer?"
First of all, we have to do our little initial research on influencer marketing. We need to know what are some factors that will have an influence on our ROI as we work with a particular person. Some of them could be their daily growth or their post-engagement ratio.
This way we can know better if the person which we are willing to work with is trying to buy likes, followers, comments, etc...
To do so, we have to gather data from Instagram for a particular time frame. This could be a week or longer. Then, we will know they aren’t using bots or buying likes and we will have a good amount of data about their numbers. There are a couple of ways to do that. For example, we can use the Instagram API or go for a third-party GitHub library.
We could also implement our own API.
As we will soon engage with coding the script, make sure you check up on Jakob's repository. Feel free to use and modify the code in a way that your solution suits your needs.
However, we will also have to think about a technology stack. For a solution of this sort, Jakob would pick Python, Django, DjangoREST Framework, and a database - PostgreSQL, MySQL, or SQLLite.
Also, we will have to plan all the relations in the database and models. Then, we will have to think about the script that will gather the data.
Remember, we don’t want to make one simple request. Doing so, our data would not be correct. We have to use a service that will help us make requests every few hours or so. This way, we can gather much more sufficient data.
For deploying our solution, we will use Amazon MWS or something of the sort.
So, it turns out that Instagram API allows us to do 200 calls per hour. In our case that wouldn’t be enough. So, we looked up different GitHub repositories. Unfortunately, they weren’t satisfactory at all, so, once again - we created our own solution to the problem.
Then, we used a Whiteboard for planning the solution.
We will need one API and the following scripts
Scaper Script 1
Our models will look like this:
- We got a category for a specific niche - in our case, this could be "Tech".
- Instagram profilesInstagram posts
- Instagram account historical data - number of followers on Monday, Tuesday, and so on. As we said, we need to know how the channel grows.
- Hashtags - discover new accounts via related hashtags.
So, we want tech influencers and we input the first hashtag for our solution - #coding. As you know, every popular hashtag has a bunch of related hashtags. What we want to do with this is create a recursive function that will work like this:
- We have #coding.
- We iterate through all related hashtags to the thing. Then, for example, we choose #computerscience.
- We then iterate through all of them and go deeper, and deeper. This way we will have a detailed set of related hashtags around our main one.
Scraper Script 2
So, our next scraper finds what we consider as good accounts.
For each hashtag, Instagram gives us a "Popular posts" grid. The First 9 of them are actually promoted by IG. We can iterate on them and add them to our database. They are totally different from each other, so, we will be adding all posts.
Scraper Script 3
Last but not least, the third script will have a crucial function - update our account. We will be updating our data every few hours - checking if there are any updates on the information we need.
The script view will ask the database if the accounts are updated. If any changes have occurred, it will do the reports. We will get the new information about posts and everything.
Now that we've run the script, it's already adding accounts and checking for new information about them. Our script even added Jakob's profile to the list, which he was very happy about.
Let’s see how things look in the API.
On the API view in DjangoREST Framework, we see the category "Tech" we added earlier.
Looking at our accounts, we already have a couple of them. Now, we can also order our accounts by their daily growth. This way we found one that grows with more than 1000 followers every single day.
Of course, we also have our posts and hashtags.
Basically, we got everything we needed to promote our product as we found a lot of influencers.
Apart from the people we want to work with, we also found a lot of huge "repost pages" that reuse content. Still, we are happy with our results, as the script was coded in a very short time.
Don’t forget that you can find the code needed for the script on Jakob’s GitHub repository.
If you are experiencing an issue or you have other ideas you want to bring to life, simply get in touch.