Last active
April 25, 2021 05:22
-
-
Save kevinjnguyen/776ee713704b51c184fb66ad77a7afbf to your computer and use it in GitHub Desktop.
Instagram Engagement Calculator | Subtle Clothing Collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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