A powerful data & AI notebook templates catalog: prompts, plugins, models, workflow automation, analytics, code snippets - following the IMO framework to be searchable and reusable in any context.
With this notebook, you can see the evolution the number of content published on LinkedIn on your personal profile, cumulated, daily since first activity.
Input
Import libraries
from naas_drivers import linkedin
import naas
import pandas as pd
# Schedule your notebook everyday at 9:00 AM
naas.scheduler.add(cron="0 9 * * *")
#-> Uncomment the line below to remove your scheduler
# naas.scheduler.delete()
Model
Get posts feed
# Get posts feed from CSV stored in your local (Return empty if CSV does not exist)
def my_function(csv_output):
...
df = pd.read_csv(csv_output)
return df
df_posts_feed = my_function(csv_output)
df_posts_feed
Get new posts
def my_function(df):
...
# Get last post URL in dataframe
last_post_url = None
# Get new posts since last url (this part is important to optimize script performance)
until = {}
if last_post_url:
until = {"POST_URL": last_post_url}
df_posts_feed = linkedin.connect(LI_AT, JSESSIONID).profile.get_posts_feed(PROFILE_URL, until=until, limit=-1)
# Merge dataframe
return
merged_df = my_function(df)
merged_df
Get trend
# Create dataframe with number of LinkedIn posts cumulated by date with daily variation
# -> Empty date must be fullfiled with last value
def get_trend(df):
...
return df
df_trend = get_trend()
df_trend
# Save your dataframe in CSV
merged_df.to_csv(csv_output, index=False)
# Share output with naas
naas.asset.add(csv_output)
#-> Uncomment the line below to remove your asset
# naas.asset.delete(csv_output)
Save and share your graph in HTML
# Save your graph in HTML
fig.write_html(html_output)
# Share output with naas
naas.asset.add(html_output, params={"inline": True})
#-> Uncomment the line below to remove your asset
# naas.asset.delete(html_output)
Save and share your graph in image
# Save your graph in PNG
fig.write_image(image_output)
# Share output with naas
naas.asset.add(image_output, params={"inline": True})
#-> Uncomment the line below to remove your asset
# naas.asset.delete(image_output)
LinkedIn - Follow Number of Content Published
Tags: #linkedin #html# plotly# csv# image #content #analytics# automation
Author: Firstname Lastname
With this notebook, you can see the evolution the number of content published on LinkedIn on your personal profile, cumulated, daily since first activity.
Input
Import libraries
Setup LinkedIn
Setup Outputs
Setup Naas
Model
Get posts feed
Get new posts
Get trend
Output
Display result
Save and share your csv file
Save and share your graph in HTML
Save and share your graph in image