This is a simple python script for an Instagram profile pictures downloader. it's downloading dp to your machine locally and then it's generating a public URL of that the same profile picture. I know so many online websites are available for the same thing and all the websites have ads and captcha and it takes too much time so that's why I created this and it's just using educational purposes.
- Easy to download Instagram profile pictures with uploaded quality
- UserName and Copy link URL support
- Save DP to your system locally and generate a public URL.
- python 3.x
- python3-pip
yum install -y git
yum install -y python3
yum install -y python3-pip
apt install -y git
apt install -y python3
apt install -y python3-pip
pkg upgrade
pkg install git
pkg install python3
pkg install pip
using termux who you guys please install requirments use
pip install -r requirements.txt
don't need to use pip3
git clone https://github.com/yousafkhamza/instagram-profile-pic-downloader-pyscript.git
cd instagram-profile-pic-downloader-pyscript
pip3 install -r requirements.txt
python3 instapic.py
# python3 instapic.py
Instagram Profile_URL/UserName: https://instagram.com/xxxxx?utm_medium=copy_link # >>>>> use both URL and UserName
Image Downloaded under dp Directory!
Image URL Generating.....
Image URL is: https://i.ibb.co/xxxxx/xxxxxxx.jpg
import requests
import json
import base64
import os
# URL Spliting.
insta_username= input('Instagram Profile_URL/UserName: ')
if insta_username.startswith("http"):
if insta_username.endswith("/"):
insta_username=insta_username.split(".com/")[1][:-1]
elif insta_username.endswith("link"):
insta_username=insta_username.split(".com/")[1].split("?")[0]
else:
insta_username=insta_username=insta_username.split(".com/")[1]
# Downloading path creation
if not os.path.exists("./dp"):
os.makedirs("./dp")
# URL Imgbb API
key_imgbb="ab6f158359d0a96a54476b63d3529d31" #public image generating imgbb key
insta_url='https://www.instagram.com'
response = requests.get(f"{insta_url}/{insta_username}/?__a=1")
# Main
if response.ok:
json_data = json.loads(response.text)
profile_pic_url=json_data["graphql"]["user"]["profile_pic_url_hd"]
r = requests.get(profile_pic_url, allow_redirects=True)
print("Image Downloaded under dp Directory!")
open(f"./dp/{insta_username}.jpeg", 'wb').write(r.content)
print("Image URL Generating.....")
with open(f"./dp/{insta_username}.jpeg", "rb") as file:
url = "https://api.imgbb.com/1/upload"
payload = {
"key": key_imgbb,
"image": base64.b64encode(file.read()),
}
r = requests.post(url, data= payload)
view_url=(json.loads(r.text)["data"]["display_url"])
print("Image URL is: "+view_url)
else:
print("UserName/Profile URL isn't correct...")
This is a python based script that is used to download Instagram profile pictures locally and it's generated an imgbb URL of that profile picture.