OlegYurchik / pyInstagram

This is a simple and easy-to-use library for interacting with the Instagram. The library works through the web interface of the Instagram and does not depend on the official API
MIT License
232 stars 49 forks source link

Getting all Likes of a specific post #51

Closed annkabe closed 5 years ago

annkabe commented 5 years ago

Hi, I am quite new to programming with Python and right now I am a bit stuck. I have a list of Instagram posts and the respective post ID. For each picture I'd like to get the amount of likes.

I've looked into the already posted questions and tried to adapt the code of getting all comments like this:

media = agent.get_media(account, count=20)

for m in media[0] likes = agent.get_likes(m, count=m.likes_count) print(likes)

This works fine. However, this gives me the likes of the first few posts of the account, which is not quite what I'm looking for. Is there a way to specifically ask for the likes of one post?

I've tried to change it like this:

media = Media("BxWyX9Sgol6")

for m in media[0] likes = agent.get_likes(m, count=m.likes_count) print(likes)

This gives me the error: 'Media' object does not support indexing

I appreciate any advice! Thanks in advance!

annkabe commented 5 years ago

Hi, I looked through the threads again and the perfect answer to my question: https://github.com/OlegYurchik/pyInstagram/issues/22

Sorry for posting in the first place, language barrier...