Get likes from post

Tags: #linkedin #post #likes #naas_drivers #content #snippet #dataframe
Author: Florent Ravenel
Last update: 2023-08-26 (Created: 2021-06-17)
Description: "This notebook is engineered to compile a list of profiles that have liked a specific LinkedIn post, and it organizes the data into a structured and easily digestible format. It creates a DataFrame that encompasses the following columns:
  • PROFILE_ID: The unique identifier for each LinkedIn profile.
  • PROFILE_URL: The URL of the individual's LinkedIn profile.
  • PUBLIC_ID: The public identifier visible in the URL of the user's LinkedIn profile.
  • FIRSTNAME: The first name of the LinkedIn user.
  • LASTNAME: The last name of the LinkedIn user.
  • FULLNAME: The full name of the LinkedIn user.
  • OCCUPATION: The professional title or job role of the LinkedIn user.
  • PROFILE_PICTURE: The URL of the LinkedIn user's profile picture.
  • BACKGROUND_PICTURE: The URL of the LinkedIn user's background picture.
  • PROFILE_TYPE: The type of LinkedIn profile (e.g., individual, company).
  • REACTION_TYPE: The type of reaction (like, love, insightful, etc.) the user has given to the post.
  • POST_URL: The URL of the LinkedIn post that received the reaction.
  • DATE_EXTRACT: The timestamp of when the reaction data was extracted.
This notebook serves as a valuable tool for social media analysis, providing insights into user engagement on LinkedIn posts."
Disclaimer: This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by Linkedin or any of its affiliates or subsidiaries. It uses an independent and unofficial API. Use at your own risk.
This project violates Linkedin's User Agreement Section 8.2, and because of this, Linkedin may (and will) temporarily or permanently ban your account. We are not responsible for your account being banned.


Import libraries

import naas
from naas_drivers import linkedin

Setup variables

  • li_at: Cookie used to authenticate Members and API clients.
  • JSESSIONID: Cookie used for Cross Site Request Forgery (CSRF) protection and URL signature validation.
  • post_url: This variable represents the LinkedIn profile URL.
li_at = naas.secret.get("LINKEDIN_LI_AT") or "YOUR_LINKEDIN_LI_AT" #example: AQFAzQN_PLPR4wAAAXc-FCKmgiMit5FLdY1af3-2
JSESSIONID = naas.secret.get("LINKEDIN_JSESSIONID") or "YOUR_LINKEDIN_JSESSIONID" #example: ajax:8379907400220387585
post_url = ""


Get likes from post URL

df = linkedin.connect(li_at, JSESSIONID).post.get_likes(post_url)
print("Likes:", len(df))


Display result