"""
Spyder Editor
This is a temporary script file.
"""
import requests
from bs4 import BeautifulSoup
username = "usernamea"
#enter above user name of the person you want to download the instagram profile picture
URL="https://www.instagram.com/{}/"
rq = requests.get(URL.format(username))
ss =BeautifulSoup(rq.text,"html.parser")
w=ss.find("meta",property="og:image")
url= w.attrs['content']
with open(username +' .jpg', "wb") as pic:
binary= requests.get(url).content
pic.write(binary)
#instagram #profile #download #picture #method 1
check the variable url output & copy that url & paste in browser to open the picture
Comments