Get comments from post
Tags: #linkedin #post #comments #naas_drivers #content #snippet #dataframe
Last update: 2023-08-26 (Created: 2021-06-17)
Description: "This notebook is designed to extract comments from a specific LinkedIn post and organize the data into a structured format. It generates a DataFrame with various details about each comment and the user who posted it.
The DataFrame includes the following columns:
PROFILE_ID
: The unique identifier associated with the LinkedIn profile of the user who posted the comment.PROFILE_URL
: The URL leading to the LinkedIn profile of the user who posted the comment.PUBLIC_ID
: The public identifier visible in the URL of the user's LinkedIn profile.FIRSTNAME
: The first name of the user who posted the comment.LASTNAME
: The last name of the user who posted the comment.FULLNAME
: The full name of the user who posted the comment.OCCUPATION
: The professional role or job title of the user who posted the comment.PROFILE_PICTURE
: The URL of the user's LinkedIn profile picture.BACKGROUND_PICTURE
: The URL of the user's LinkedIn background picture.PROFILE_TYPE
: The type of LinkedIn profile (e.g., individual, company).TEXT
: The actual text of the comment posted by the user.CREATED_TIME
: The timestamp indicating when the comment was posted.LANGUAGE
: The language in which the comment was written.DISTANCE
: The degree of connection between the user who posted the comment and the profile viewing the post (e.g., 1st-degree connection, 2nd-degree connection).COMMENTS
: The number of comments on the user's comment.LIKES
: The number of likes on the user's comment.POST_URL
: The URL of the LinkedIn post where the comment was made.DATE_EXTRACT
: The timestamp indicating when the comment data was extracted.
The notebook is a useful tool for social media analysis and can help in understanding 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 naas
from naas_drivers import linkedin
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 = ""
df = linkedin.connect(li_at, JSESSIONID).post.get_comments(post_url)
print("Comments:", len(df))
df.head(1)
df