Skip to content

Instantly share code, notes, and snippets.

@kevinjnguyen
Last active April 25, 2021 05:22
Show Gist options
  • Save kevinjnguyen/776ee713704b51c184fb66ad77a7afbf to your computer and use it in GitHub Desktop.
Save kevinjnguyen/776ee713704b51c184fb66ad77a7afbf to your computer and use it in GitHub Desktop.
Instagram Engagement Calculator | Subtle Clothing Collection
target_profile = PROFILE_NAME
from instaloader import Instaloader, Profile
loader = Instaloader()
profile = Profile.from_username(loader.context, target_profile)
num_followers = profile.followers
total_num_likes = 0
total_num_comments = 0
total_num_posts = 0
for post in profile.get_posts():
total_num_likes += post.likes
total_num_comments += post.comments
total_num_posts += 1
engagement = float(total_num_likes + total_num_comments) / (num_followers * total_num_posts)
print(engagement * 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment