Towards AI Can Help your Team Adopt AI: Corporate Training, Consulting, and Talent Solutions.


Scan LinkedIn posts to analyze Emotions, Sentiments, and Trends using AI

Scan LinkedIn posts to analyze Emotions, Sentiments, and Trends using AI

Last Updated on October 16, 2022 by Editorial Team

Author(s): Shubham Saboo

Originally published on Towards AI the World’s Leading AI and Technology News and Media Company. If you are building an AI-related product or service, we invite you to consider becoming an AI sponsor. At Towards AI, we help scale AI and technology startups. Let us help you unleash your technology to the masses.

Learn how to analyze LinkedIn posts for useful insights with just a few lines of Python code.


It is incredible how the digital world is so dynamic and ever-changing. There is something new and exciting happening every other day. This is evident from the fact that every day there is some new topic that interests people and triggers discussions on social media. What might be popular today might get outdated tomorrow!

Let’s first understand what trending topics are. A trending topic on social media is something that is being talked about more than usual. It can be about anything that people are interested in at the moment, based on what is happening worldwide.

There’s no doubt that social media has changed the way we communicate and connect with each other. With so many people using social media, it’s no surprise that it’s become a hotbed for trending topics. Whether it’s a new meme, a controversial news story, or a heartwarming moment, social media is where people go to share and discuss the things happening in the world. And because of the way social media works, these topics can spread like wildfire, with everyone from celebrities to everyday people weighing in on the conversation.

Analysis of hot trends: Why is it important?

In the past, the content was created with the intention of being timeless. This meant that it was often created without any reference to current trends or events. However, content today is focused more on real-time events and news. Marketers are now using trends to their advantage, creating content that is more likely to be shared and seen by a wider audience. This has also enabled them to understand where the brand is currently positioned by customers allowing them to improvise their product and content accordingly.

Additionally, they are also using trends to target specific demographics that they know are more likely to be interested in their content/product. This has led to more effective use of marketing resources and a higher return on investment for content creators.

I would specifically like to quote Amul’s marketing strategy here and how they’ve aced the game!

In the old days, Amul relied on the simple strategy of painting walls and huge billboards with a mascot that could be easily painted and looked relatable. However, adapting to this ever-evolving environment, Amul has had a great eye for what’s currently trending.

They have monetized these opportunities by making ads on trending topics and engaging with the masses. The time when Amul took a dig at Elon Musk for his takeover attempt on Twitter, for instance.

Source: Amul Instagram

Or when every second word you read on social media was about Squid Games.

Source: Amul Instagram

Well, now that we understand how important it is to monitor trending topics on social media, we all know how difficult it can get to constantly keep a watch. The sheer volume of information that is generated on social media platforms every day is the biggest challenge. How to sift through all of this information to identify trends? Additionally, trends on social media can change very rapidly, making it hard to keep up with them. Finally, social media users are often anonymous, which makes it difficult to identify and engage with them. Then how to stay relevant throughout?!

What if I tell you that AI and a few lines of Python code can do the job for you? 🤯

Introducing OneAI Studio!

One AI is a language AI service where various pre-trained NLP models are packaged and made available through API, enabling language comprehension in context and transforming texts from any source into structured data. One AI studio is capable of performing a wide array of tasks including but not limited to:

  • Transcribing audio files
  • Generating Highlights of the input
  • Topic extraction
  • Emotions as well as Sentiments detection
  • Identification of Keywords
  • Identifying Action Items
  • Clustering the data basis skills as parameters like Keywords or Sentiments, etc.
One AI Studio Interface

Check out my previous blog post on Detect Business Insights From Customer Support Conversations that leverages the OneAI API.

Let’s look at how you can build a streamlit application to scan a social media post for analyzing topics, emotions, and sentiments using One AI and Python. All you need to have is the following:

  • Basic knowledge of Python
  • Streamlit
  • One AI API

Application Walkthrough

We will use the Streamlit framework to build a beautiful front end in python itself. Here is a step-by-step walkthrough to building a Python application for analyzing social media posts:

  1. Import the necessary libraries and get the API key from the user.

2. Get the LinkedIn post URL from the user and extract the text information using the OneAI API’s “Html-to-Article” endpoint.

3. Create the functionality to allow users to select between different intelligence features and add them to the API as skills.

4. Set the headers, API endpoint address, and the payload to be sent to the API. Use the request library to hit the API endpoint and get the output returned in JSON format.

5. Process the JSON file and display the output to the end users!

🌟 Here is the GitHub repository to get the source code:

GitHub – Shubhamsaboo/ai-linkedin-post-scanner

This is what our final application looks like 👇

🕹 AI-powered LinkedIn Post Scanner in Action

Now let’s look at how we can use the above application in real-world scenarios:

Step 1: First things first, you have to put in your API Key for authentication. Copy your One AI API Key and paste it onto the sidebar.

Getting the API key (Screen-1)
Getting the API key (Screen-2)

Paste the API key in the application sidebar.

Step 2: Let’s get the ball rolling. Enter the link of the LinkedIn post that you want to scan. Once you enter the link, click the Get Text button to extract the text data from the post. I pasted the URL of my following LinkedIn post.

Step 3: Once you extract the text data from the LinkedIn post, the next step is to perform some intelligent NLP tasks on that data to get useful insights. You can perform the following tasks on the extracted text.

i. Emotion Detection

ii. Sentiment Detection

iii. Topic Detection

Try it out yourself 👉 Streamlit Application


The power of social media to shape and change the world is evident from the fact that it can make even the most mundane topics trending. Whether it’s a new meme or a heartwarming moment, social media has the ability to make anything go viral. This is why it’s so important to be aware of the trends and conversations happening on social media, as they can provide valuable insights into what people are interested in and thinking about.

If you would like to learn more or want me to write more on this subject, feel free to reach out.

My social links: LinkedIn| TwitterGithub

If you liked this post or found it helpful, please take a minute to press the clap button, it increases the post’s visibility for other medium users.

Scan LinkedIn posts to analyze Emotions, Sentiments, and Trends using AI was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Join thousands of data leaders on the AI newsletter. It’s free, we don’t spam, and we never share your email address. Keep up to date with the latest work in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓