Answer the question
In order to leave comments, you need to log in
How to get the latest likes of a post on Instagram?
You need to get the last 5-10 people who liked the post on Instagram.
If not, then the last 5-10 followers.
How to do it? The API does not respond to them at all (I'm a registered developer)
Is it possible to do this somehow without the API? If so, how?
Thank you very much in advance for your reply.
Answer the question
In order to leave comments, you need to log in
The answer was on the surface.
unoffical instagram api wrapper
Code itself:
def get_media_likers(API, mediaID):
retUsers = []
while True:
API.getMediaLikers(mediaID)
usersJson = API.LastJson
for user in usersJson['users']:
retUsers.append(UserProfile(user['pk'], user['username']))
else:
break
return retUsers
class UserProfile:
def __init__(self, id, username):
self.id = id
self.username = username
parse = urlparse(url)
path = parse[2]
apiUrl = "https://api.instagram.com/oembed/?url=http://instagram.com/{}".format(path)
r = requests.get(apiUrl)
mediaID = r.json()['media_id']
def is_instagram_like(username, url):
if url[-1] != "/":
url = url + "/"
parse = urlparse(url)
path = parse[2]
apiUrl = "https://api.instagram.com/oembed/?url=http://instagram.com/{}".format(path)
r = requests.get(apiUrl)
mediaID = r.json()['media_id']
likers = get_media_likers(API, mediaID)
for liker in likers:
if liker.username == username:
return True
return False
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question