|
| 1 | + |
| 2 | +# INSTAGRAM PROFILE DOWNLOADER |
| 3 | + |
| 4 | +# imported necessary library |
| 5 | +from tkinter import * |
| 6 | +import tkinter as tk |
| 7 | +import tkinter.messagebox as mbox |
| 8 | +from pil import ImageTk, Image |
| 9 | +import cv2 |
| 10 | +import glob |
| 11 | +import webbrowser |
| 12 | +import instaloader |
| 13 | + |
| 14 | + |
| 15 | +# Main Window & Configuration |
| 16 | +window = tk.Tk() # created a tkinter gui window frame |
| 17 | +window.title("Instagram File Downloader") |
| 18 | +window.geometry('1000x710') |
| 19 | + |
| 20 | +#Define a callback function |
| 21 | +def callback(url): |
| 22 | + webbrowser.open_new_tab(url) |
| 23 | + |
| 24 | +# top label |
| 25 | +start1 = tk.Label(text = "INSTA", font=("Arial", 45), fg="magenta3") # same way bg |
| 26 | +start1.place(x = 30, y = 10) |
| 27 | + |
| 28 | +# top label |
| 29 | +start1 = tk.Label(text = "PROFILE", font=("Arial", 45), fg="VioletRed1") # same way bg |
| 30 | +start1.place(x = 240, y = 10) |
| 31 | + |
| 32 | +# top label |
| 33 | +start1 = tk.Label(text = "DOWNLOADER", font=("Arial", 45), fg="gold2") # same way bg |
| 34 | +start1.place(x = 530, y = 10) |
| 35 | + |
| 36 | + |
| 37 | +def start_fun(): |
| 38 | + window.destroy() |
| 39 | + |
| 40 | +# start button created |
| 41 | +startb = Button(window, text="▶\nSTART",command=start_fun,font=("Arial", 25), bg = "light green", fg = "blue", borderwidth=3, relief="raised") |
| 42 | +startb.place(x =50 , y =320 ) |
| 43 | + |
| 44 | +# goto button created |
| 45 | +gotob = Button(window, text="GO TO INSTAGRAM",command=lambda:callback("https://www.instagram.com/"),font=("Arial", 25), bg = "orange", fg = "blue", borderwidth=3, relief="raised") |
| 46 | +gotob.place(x =335 , y =615 ) |
| 47 | + |
| 48 | +# image on the main window |
| 49 | +path = "Images/front.png" |
| 50 | +# Creates a Tkinter-compatible photo image, which can be used everywhere Tkinter expects an image object. |
| 51 | +img1 = ImageTk.PhotoImage(Image.open(path)) |
| 52 | +# The Label widget is a standard Tkinter widget used to display a text or image on the screen. |
| 53 | +panel = tk.Label(window, image = img1) |
| 54 | +panel.place(x = 250, y = 80) |
| 55 | + |
| 56 | +# function created for exiting |
| 57 | +def exit_win(): |
| 58 | + if mbox.askokcancel("Exit", "Do you want to exit?"): |
| 59 | + window.destroy() |
| 60 | + |
| 61 | +# exit button created |
| 62 | +exitb = Button(window, text="❌\n EXIT ",command=exit_win,font=("Arial", 25), bg = "red", fg = "blue", borderwidth=3, relief="raised") |
| 63 | +exitb.place(x =820 , y = 320 ) |
| 64 | +window.protocol("WM_DELETE_WINDOW", exit_win) |
| 65 | +window.mainloop() |
| 66 | + |
| 67 | +# Main Window & Configuration |
| 68 | +window1 = tk.Tk() # created a tkinter gui window frame |
| 69 | +window1.title("Instagram File Downloader") # title given is "DICTIONARY" |
| 70 | +window1.geometry('1000x700') |
| 71 | + |
| 72 | + |
| 73 | +def preview_fun(): |
| 74 | + global entered_user_name |
| 75 | + |
| 76 | + path1 = "./" + entered_user_name + "/*.jpg" |
| 77 | + # print(path1) |
| 78 | + # print(glob.glob(path1)) |
| 79 | + for img in glob.glob(path1): |
| 80 | + # print("ksjd") |
| 81 | + cv_img = cv2.imread(img) |
| 82 | + cv2.imshow("Profile Pic", cv_img) |
| 83 | + |
| 84 | +def down_fun(): |
| 85 | + global entered_user_name |
| 86 | + entered_user_name = str(path_text.get("1.0", "end-1c")) |
| 87 | + |
| 88 | + ig = instaloader.Instaloader() |
| 89 | + ig.download_profile(entered_user_name, profile_pic_only=True) |
| 90 | + |
| 91 | + path = "./" + entered_user_name + "/id" |
| 92 | + # print(path) |
| 93 | + file1 = open(path, "r") |
| 94 | + # print(file1.read()) |
| 95 | + id1.configure(text=str(file1.read())) |
| 96 | + mbox.showinfo("Success",entered_user_name + "'s Profile Downloaded Successfully.\n\nAnd Saved to Project Directory.") |
| 97 | + |
| 98 | +start1 = tk.Label(text = "INSTAGRAM", font=("Arial", 55), fg="magenta3") # same way bg |
| 99 | +start1.place(x = 80, y = 10) |
| 100 | + |
| 101 | +# top label |
| 102 | +start1 = tk.Label(text = "PROFILE", font=("Arial", 55), fg="VioletRed1") # same way bg |
| 103 | +start1.place(x = 570, y = 10) |
| 104 | + |
| 105 | +# top label |
| 106 | +start1 = tk.Label(text = "DOWNLOADER", font=("Arial", 55), fg="gold2") # same way bg |
| 107 | +start1.place(x = 220, y = 90) |
| 108 | + |
| 109 | +lbl1 = tk.Label(text="Enter Insta User Name...", font=("Arial", 30),fg="brown") # same way bg |
| 110 | +lbl1.place(x=80, y=220) |
| 111 | + |
| 112 | +path_text = tk.Text(window1, height=1, width=37, font=("Arial", 30), bg="light yellow", fg="orange",borderwidth=2, relief="solid") |
| 113 | +path_text.place(x=80, y = 280) |
| 114 | + |
| 115 | +lbl1 = tk.Label(text="Insta User ID : ", font=("Arial", 30),fg="brown") # same way bg |
| 116 | +lbl1.place(x=80, y=400) |
| 117 | + |
| 118 | +id1 = tk.Label(font=("Arial", 30),fg="orange") # same way bg |
| 119 | +id1.place(x=360, y=400) |
| 120 | + |
| 121 | +# Get Images Button |
| 122 | +getb=Button(window1, text="DOWNLOAD",command=down_fun, font=("Arial", 25), bg = "light green", fg = "blue") |
| 123 | +getb.place(x = 400, y = 500) |
| 124 | + |
| 125 | +# Get Images Button |
| 126 | +getb=Button(window1, text="PROFILE",command=preview_fun, font=("Arial", 25), bg = "orange", fg = "blue") |
| 127 | +getb.place(x = 100, y = 590) |
| 128 | + |
| 129 | +def clear_fun(): |
| 130 | + path_text.delete("1.0", "end") |
| 131 | + |
| 132 | +# Get Images Button |
| 133 | +clearb=Button(window1, text="CLEAR",command=clear_fun, font=("Arial", 25), bg = "yellow", fg = "blue") |
| 134 | +clearb.place(x = 445, y = 590) |
| 135 | + |
| 136 | +def exit_win1(): |
| 137 | + if mbox.askokcancel("Exit", "Do you want to exit?"): |
| 138 | + window1.destroy() |
| 139 | + |
| 140 | +# Get Images Button |
| 141 | +getb=Button(window1, text="EXIT",command=exit_win1, font=("Arial", 25), bg = "red", fg = "blue") |
| 142 | +getb.place(x = 780, y = 590) |
| 143 | + |
| 144 | +window1.protocol("WM_DELETE_WINDOW", exit_win1) |
| 145 | +window1.mainloop() |
| 146 | + |
0 commit comments