Skip to content

Codewithap

  • About
  • YouTube Channel
  • Contact

How to get Instagram Account Details in Python GUI App 2022

June 25, 2024March 15, 2022 by Akashkumar
Table of Contents show
Python Tkinter GUI App Design
Final Output – Instagram account details in python
instagram account info

Today we will learn how to get Instagram account details in Python programming. Also, we will create a GUI Tkinter design that takes input as an Instagram profile ID and fetch the details with the help of JSON requests.

So in this application, we will try to get the user name, full name, followers count, the following count, bio-link, account type whether it is a business or private account, category, and profile pic display.

You can watch the full video on youtube with the step-by-step python Tkinter GUI app

Python Tkinter GUI App Design

Let’s get started first with GUI Tkinter design and then we will write the function for getting profile information and display image.

First, you need to install Tkinter to create a GUI application, you can use the below command from the terminal (Windows, Mac, Linux):

pip install tk or sudo apt-get install python3-tk

Now write the code to create a GUI like the below image, however, you can design as per your requirement because I have just created a simple GUI for learning purposes, but you can add more features.

gui insta design

Now you can use the full source code below with implementation:

from tkinter import *
import tkinter as tk
import requests

root = tk.Tk()
root.title("Instagram User Information")
root.geometry('450x350')

def searchProfile():
    user_name = user.get()
    url = f"https://www.instagram.com/{user_name}/?_a=1"
    data = requests.get(url).json()
    print(data)

    def profilePic():
        import webbrowser
        user_pic = data['graphql']['user']['profile_pic_url']
        webbrowser.open(user_pic)

    if details.get(1.0, END) != "":
        details.delete(1.0, END)
        details.insert(1.0, f"\n User Name : {data['graphql']['user']['username']} \n Followers : {['graphql']['user']['edge_followed_by']['count']} || Following : {data['graphql']['user']['edge_follow']['count']} \n Full Name : {data['graphql']['user']['full_name']} \n Total Post : {data['graphql']['user']['edge_owner_to_timeline_media']['count']} || Category : {data['graphql']['user']['category_enum']} \n Bio-Link : {data['graphql']['user']['external_url']} || Private Account : {data['graphql']['user']['is_private']} \n Verified Account : {data['graphql']['user']['is_verified']} || Bussiness Account : {data['graphql']['user']['is_bussiness_account']} \n \n \n See Profile Picture")

        Button(frame2, text="Click to View", relief=RAISED, borderwidth=2, font=('verdana', 10, 'bold'), bg='#248aa2', fg="white", command=profilePic).place(x=150, y=190)

frame1 = Frame(root, width=450, height=350, relief=RIDGE, borderwidth=5, bg='#FAD7A0')
frame1.place(x=0, y=0)

user = Entry(frame1, width=20, relief=RIDGE, borderwidth=3, font=('verdana', 10))
user.place(x=70, y=10)

search = Button(frame1, text="Search", relief=RAISED, borderwidth=2, font=('verdana', 10, 'bold'), bg='#248aa2', fg="white", command=searchProfile)
search.place(x=270, y=8)

frame2 = LabelFrame(frame1, width=420, height=290, relief=RIDGE, borderwidth=3, bg='#248aa2', highlightcolor="white", highlightbackground="white", highlightthickness=2)
frame2.place(x=5, y=45)

label = Label(frame2, text="User Details", highlightbackground="white", highlightcolor="white", highlightthickness=5, font=('verdana', 10, 'bold'))
label.place(x=5, y=5)

details = Text(frame2, height=13, width=48, relief=RIDGE, borderwidth=5, highlightbackground="white", highlightcolor="white", font=('verdana', 10, ''))
details.place(x=5, y=40)

root.mainloop()

Final Output – Instagram account details in python

Once you run the above code, you will get the output like below:

insta profile info
output

Now, once you click on the button “Click to View”, it will show you the Instagram account profile picture on the web browser.

I hope you like this example, you can try it out yourself and make changes according to your project need. Check our interesting python exercises that you can use for practice.

Categories Python Programming
Blockchain Development learning guide and Salary in 2022
8 Ways to Secure your Laptop from Hackers in 2022
Sharing Is Caring:
Akashkumar

I'm a Computer Science graduate. I'm passionate about blogging and I owned codewithap.com to share some of my interests with other people.

...

akash-bio-pic

YouTube

Facebook

Pinterest

Categories

  • Android (5)
  • Computer Security (1)
  • Education (4)
  • Python Programming (2)
  • Technology (6)
  • Web Hosting (1)

Recent Post

  • mysql crud operations pythonMySQL CRUD Operations in Python Using GUI Tkinter
  • beginner blogging tipsBeginner Blogging Tips: 12 Easy Steps to Start a New Blog
  • ai hearing aids4 Perfect AI Hearing Aids That Help You Hear Better
  • prepare for amazon interviewPrepare For Amazon Interview: 6 Things You Should Know
  • switch to a career in big dataHow To Make The Switch To A Career In Big Data 2022
  • Contact
  • Privacy Policy
  • About Codewithap
Copyright © 2022 Codewithap. All rights reserved.
  • About
  • YouTube Channel
  • Contact