-1

very new coder here. im tryna help someone get the data of an instagram post (picture, username, caption and link of the post). im currently using instaloader to download the picture and get the username and caption of the post. the problem im facing is that instaloader only gives me the url of the picture, not of the entire post, and google searching this i find most people giving ways of getting the url of the picture. does anyone know how to use python (instaloader or not) to get the url of an instagram post?

1 Answers1

2

To get the post's url, you can use instaloader's Post.shortcode property to construct it. Something this should work:

import instaloader

USER = ""
PASSWORD = ""

L = instaloader.Instaloader()
L.login(USER, PASSWORD)

posts = L.get_feed_posts() # Get the user's feed
for post in posts:
    print(f"https://www.instagram.com/p/{post.shortcode}") # Print each post's url
Max Ojeda
  • 21
  • 2