Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions likes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import instaloader
import matplotlib.pyplot as plt
from PIL import Image
import requests
from io import BytesIO


L = instaloader.Instaloader()

USER = "talestheytell"
PROFILE = USER
L.interactive_login(USER)


profile = instaloader.Profile.from_username(L.context, PROFILE)
likes=[]
comments=[]
#url=[]
print("Fetching likes of all posts of profile {}.".format(profile.username))
for post in profile.get_posts():
likes.append(post.likes)
comments.append(post.comments)
#url.append(post.url)
# response = requests.get(post.url)
# img = Image.open(BytesIO(response.content))
# img.show()

print(likes)
print(comments)
total_likes=sum(likes)
total_comments=sum(comments)
print(total_likes)
print(total_comments)
avg_likes=total_likes//len(likes)
print(avg_likes)
avg_comments=total_comments//len(comments)
print(avg_comments)

# likes = likes+len(set(post.get_likes()))
# print(likes)

#print("Fetching followers of profile {}.".format(profile.username))
#followers = set(profile.get_followers())

# ghosts = followers - likes

# print("Storing ghosts into file.")
# with open("inactive-users.txt", 'w') as f:
# for ghost in ghosts:
# print(ghost.username, file=f)Vaani@787