Answer the question
In order to leave comments, you need to log in
How to get a link to a post with an instagram avatar?
There are services that provide a link to a post with an avatar of an Instagram account.
You can find such services by requesting "like/comment on Instagram profile picture".
I know how to get a profile picture on instagram, but I don't know how to get a link to a post with this photo so that I can comment on it. I would like to see the code mainly in Python, but you can use any other code, or get a link to an article / documentation where there is an answer to my question.
Answer the question
In order to leave comments, you need to log in
First you need to find out the user id, I think this will not cause difficulties.
Then we get json from the id of the avatar:
user_id = id жертвы
profile_pic = session.get(f'https://i.instagram.com/api/v1/users/{user_id}/info/').json()
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
def id_to_code(media_id):
shortcode = ''
while media_id > 0:
tail = media_id % 64
media_id = (media_id - tail) // 64
shortcode = alphabet[tail] + shortcode
return shortcode
shortcode = id_to_code(pic_id)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question