1
|
|
|
# ------------------Import Files--------------------------------------------- |
2
|
|
|
import pytube |
3
|
|
|
from pytube import YouTube |
4
|
|
|
from pytube import Playlist |
5
|
|
|
import sys |
6
|
|
|
import re |
7
|
|
|
import requests as r |
8
|
|
|
import wget |
9
|
|
|
from tkinter import PhotoImage, Label, StringVar, Entry, Button, IntVar, \ |
10
|
|
|
Radiobutton, messagebox, filedialog, Frame, X, Y, LEFT, RIGHT, \ |
11
|
|
|
N, FLAT, CENTER, Canvas, Scrollbar, VERTICAL, BOTH, SUNKEN, SOLID |
12
|
|
|
import tkinter as tk |
13
|
|
|
from tkinter import ttk |
14
|
|
|
import clipboard |
15
|
|
|
import webbrowser |
16
|
|
|
from tkinterhtml import HtmlFrame |
17
|
|
|
import time |
18
|
|
|
# ============================ Window Design ================================ |
19
|
|
|
top = tk.Tk() |
20
|
|
|
# Styles and Designs Functions for Screens |
21
|
|
|
# Color set for youtube for selectcolor, bg & activebackground #0B1D6F |
22
|
|
|
yt_col = "#0B1D6F" # Youtube bg Color |
23
|
|
|
# Color set for facebook for selectcolor, bg & activebackground #075C90 |
24
|
|
|
fb_col = '#075C90' # Facebook bg Color |
25
|
|
|
col_show = 'white' # pure white fg |
26
|
|
|
col_select = 'gray' # gray for activeforeground |
27
|
|
|
COLOR_1 = "#90B3DD" # TabControl Config Color |
28
|
|
|
|
29
|
|
|
# Font Style and Size |
30
|
|
|
large_font = font = ('Cascadia Mono', 16) # style='my.head' |
31
|
|
|
DisFont = font = ('', 14) # style='my.default' |
32
|
|
|
SubFont = font = ('Consolas', 12) # style='my.sub' |
33
|
|
|
tab_font = font = ('Consolas', 12) # Tab font style |
34
|
|
|
# --------------------Maintenanceworkprocess-----------------# |
35
|
|
|
def Maintenanceworkprocess(): |
36
|
|
|
messagebox.showinfo("FYIT", "This Feature is Under Maintenance") |
37
|
|
|
|
38
|
|
|
# ------------------------- Tab Control Style Config ---------------------- |
39
|
|
|
|
40
|
|
|
tab_show = "#90B3DD" |
41
|
|
|
tab_select = "#C8D9EE" |
42
|
|
|
style = ttk.Style() |
43
|
|
|
style.theme_create("pop", |
44
|
|
|
parent="alt", |
45
|
|
|
settings={ |
46
|
|
|
"TNotebook": { |
47
|
|
|
"configure": { |
48
|
|
|
"tabmargins": [5, 5, 2, 0] |
49
|
|
|
} |
50
|
|
|
}, |
51
|
|
|
"TNotebook.Tab": { |
52
|
|
|
"configure": { |
53
|
|
|
"padding": [100, 5], |
54
|
|
|
"font": tab_font, |
55
|
|
|
"background": tab_show |
56
|
|
|
}, |
57
|
|
|
"map": { |
58
|
|
|
"background": [("selected", tab_select)], |
59
|
|
|
"expand": [("selected", [1, 2, 2, 0])] |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
}) |
63
|
|
|
|
64
|
|
|
style.theme_use("pop") |
65
|
|
|
|
66
|
|
|
# Style for Buttons |
67
|
|
|
s_btn = ttk.Style() # Toggle Button |
68
|
|
|
s_btn.configure('my.TButton', |
69
|
|
|
anchor='center', |
70
|
|
|
font=('Cascadia Mono', 8)) |
71
|
|
|
|
72
|
|
|
m_btn = ttk.Style() # Download and Cancel Button for both tab02 & 2 |
73
|
|
|
m_btn.configure('WD.TButton', anchor='center', |
74
|
|
|
activebackground="lightgreen", |
75
|
|
|
activeforeground="blue", |
76
|
|
|
font=('Cascadia Mono', 16)) |
77
|
|
|
|
78
|
|
|
# Notebook Style Config |
79
|
|
|
noteStyler = ttk.Style() |
80
|
|
|
noteStyler.configure("TNotebook", |
81
|
|
|
background=COLOR_1, |
82
|
|
|
anchor=CENTER, |
83
|
|
|
borderwidth=0) |
84
|
|
|
|
85
|
|
|
# ------------------------ Screen and Tab ----------------------------------- |
86
|
|
|
|
87
|
|
|
tabControl = ttk.Notebook(top) |
88
|
|
|
|
89
|
|
|
|
90
|
|
|
|
91
|
|
|
tab01 = ttk.Frame(tabControl) # tab01 - Facebook |
92
|
|
|
tabControl.add(tab01, text='Facebook') |
93
|
|
|
|
94
|
|
|
tab02= ttk.Frame(tabControl) # tab02 - Youtube |
95
|
|
|
tabControl.add(tab02, text='Youtube') |
96
|
|
|
|
97
|
|
|
tab3 = ttk.Frame(tabControl) # Tab3 - About |
98
|
|
|
tabControl.add(tab3, text='About') |
99
|
|
|
tabControl.pack(expand=1, fill="both") |
100
|
|
|
|
101
|
|
|
top.iconbitmap('Assets/YoutubeDownloader.ico') # Window Title Icon |
102
|
|
|
top.title("FYIT Download Manager :") # Title Label |
103
|
|
|
top.geometry("800x500+100+100") # Screen Size |
104
|
|
|
|
105
|
|
|
photo = PhotoImage(file="Assets/youtube_bg.png") # tab02 Background |
106
|
|
|
w = Label(tab02, image=photo) |
107
|
|
|
w.pack() |
108
|
|
|
|
109
|
|
|
photo2 = PhotoImage(file="Assets/facebook_bg.png") # tab01 Background |
110
|
|
|
w2 = Label(tab01, image=photo2) |
111
|
|
|
w2.pack() |
112
|
|
|
|
113
|
|
|
top.resizable(0, 0) # Disable the Maximize & Minimize option |
114
|
|
|
|
115
|
|
|
# -----------Close Function-------------------------------------------------- |
116
|
|
|
|
117
|
|
|
def close_btn(): |
118
|
|
|
if messagebox.askyesno("FYIT..", "Are you Sure you want to exit") is True: |
119
|
|
|
top.withdraw() |
120
|
|
|
top.destroy() |
121
|
|
|
top.exit() |
122
|
|
|
|
123
|
|
|
# --------------------------------------------------------------------------- |
124
|
|
|
|
125
|
|
|
var1 = StringVar() |
126
|
|
|
# Entry Widget for Youtube Downloader Tab |
127
|
|
|
url = Entry(tab02, textvariable=var1, font=large_font, fg='darkblue') |
128
|
|
|
url.place(x=70, y=117, width=500, height=30) |
129
|
|
|
|
130
|
|
|
# Entry Widget for Facebook Downloader Tab |
131
|
|
|
url_fb = Entry(tab01, textvariable=var1, font=large_font, fg='darkblue') |
132
|
|
|
url_fb.place(x=70, y=117, width=500, height=30) |
133
|
|
|
|
134
|
|
|
# Quit_button placed in tab02 |
135
|
|
|
quit_button = Button(tab02, |
136
|
|
|
text="Quit", |
137
|
|
|
relief=SOLID, |
138
|
|
|
font=SubFont, |
139
|
|
|
cursor='hand2', |
140
|
|
|
command=close_btn) |
141
|
|
|
quit_button.place(x=60, y=400, width=200, height=30) |
142
|
|
|
|
143
|
|
|
# ----------------------- Auto URL Paste Functions -------------------------- |
144
|
|
|
temp = clipboard.paste() |
145
|
|
|
url.insert('end', temp) |
146
|
|
|
url_fb.insert('end', temp) |
147
|
|
|
var1.set(temp) |
148
|
|
|
|
149
|
|
|
def paste(): # Paste text from Clipboard - Function |
150
|
|
|
variable = clipboard.paste() |
151
|
|
|
url.insert('end', variable) |
152
|
|
|
url_fb.insert('end', variable) |
153
|
|
|
var1.set(variable) |
154
|
|
|
|
155
|
|
|
def e1_delete(): # Clear text from Entry - Function |
156
|
|
|
url.delete(0, 'end') |
157
|
|
|
url_fb.delete(0, 'end') |
158
|
|
|
|
159
|
|
View Code Duplication |
def toggle(tog=[0]): # Toggle Button for clear and paste |
|
|
|
|
160
|
|
|
tog[0] = not tog[0] |
161
|
|
|
if tog[0]: |
162
|
|
|
t_btn.config(text='Paste') |
163
|
|
|
t_btn1.config(text='Paste') |
164
|
|
|
e1_delete() |
165
|
|
|
else: |
166
|
|
|
t_btn.config(text='Clear') |
167
|
|
|
t_btn1.config(text='Clear') |
168
|
|
|
paste() |
169
|
|
|
|
170
|
|
|
# tab02 clear & paste |
171
|
|
|
t_btn1 = ttk.Button(tab02, text="Clear", cursor='hand2', style='my.TButton', command=toggle) |
172
|
|
|
t_btn1.place(x=571, y=118, width=45, height=29) |
173
|
|
|
|
174
|
|
|
# tab01 clear & paste |
175
|
|
|
t_btn = ttk.Button(tab01, text="Clear", cursor='hand2', style='my.TButton', command=toggle) |
176
|
|
|
t_btn.place(x=571, y=118, width=45, height=29) |
177
|
|
|
|
178
|
|
|
# ------------------ Fetching Part from Youtube ---------------------------- |
179
|
|
|
|
180
|
|
|
new = 1 |
181
|
|
|
url1 = "https://bit.ly/site-fyit" |
182
|
|
|
res_url = "https://github.com/DeepakChakravarthy/YoutubeDownloader-FYI/releases/download/V3.0/FYI.DOWNLOAD.EXE" |
183
|
|
|
|
184
|
|
|
def openweb(): # Software Update response |
185
|
|
|
webbrowser.open(url1, new=new) |
186
|
|
|
|
187
|
|
|
def update_check(): # AutoCheck Software Update |
188
|
|
|
response = r.get(res_url) |
189
|
|
|
response.raise_for_status() |
190
|
|
|
if messagebox.askyesno("Software Update", |
191
|
|
|
"New Update is Availabe, Click yes to install.") is True: |
192
|
|
|
openweb() |
193
|
|
|
cust_font = font = ('Consolas', 12) |
194
|
|
|
label = Label(tab02, |
195
|
|
|
text="YoutubeDownloader is Under Maintenance", |
196
|
|
|
font=cust_font, bg="#1B1B19", fg="#ffffff") |
197
|
|
|
|
198
|
|
View Code Duplication |
def get_fetch(): |
|
|
|
|
199
|
|
|
resolution = Rvideo.get() |
200
|
|
|
Select = A_Video.get() |
201
|
|
|
Selection = A_Audio.get() |
202
|
|
|
|
203
|
|
|
try: |
204
|
|
|
update_check() |
205
|
|
|
except r.exceptions.HTTPError as err: |
206
|
|
|
messagebox.showinfo("FYIT", "Select Location to Save the File.") |
207
|
|
|
except r.ConnectionError as e: |
208
|
|
|
messagebox.showinfo("Connection Error", "Check the Internet Connection") |
209
|
|
|
|
210
|
|
|
try: |
211
|
|
|
if var1 is None: |
212
|
|
|
print("error") |
213
|
|
|
dirname = filedialog.askdirectory(parent=tab02, |
214
|
|
|
initialdir="/", |
215
|
|
|
title='Please select a directory:') |
216
|
|
|
if dirname: |
217
|
|
|
try: |
218
|
|
|
# Youtube Video with Resolution |
219
|
|
|
if resolution <= 3: |
220
|
|
|
yt = pytube.YouTube(var1.get()) |
221
|
|
|
if resolution == 1: |
222
|
|
|
progress_bar = ttk.Progressbar(tab02, |
223
|
|
|
orient='horizontal', |
224
|
|
|
length=500, |
225
|
|
|
mode='determinate') |
226
|
|
|
progress_bar.place(x=70, y=160) |
227
|
|
|
progress_bar.start() |
228
|
|
|
messagebox.showinfo( |
229
|
|
|
"Download", |
230
|
|
|
"Downloading.. Please Wait for a Minute.") |
231
|
|
|
video = yt.streams.get_by_itag(22) |
232
|
|
|
video.download(dirname) |
233
|
|
|
messagebox.showinfo("Downloaded. ", "Thank You..") |
234
|
|
|
elif resolution == 2: |
235
|
|
|
progress_bar = ttk.Progressbar(tab02, |
236
|
|
|
orient='horizontal', |
237
|
|
|
length=500, |
238
|
|
|
mode='determinate') |
239
|
|
|
progress_bar.place(x=70, y=160) |
240
|
|
|
progress_bar.start() |
241
|
|
|
messagebox.showinfo("Download", "Downloading...") |
242
|
|
|
video = yt.streams.first() |
243
|
|
|
video.download(dirname) |
244
|
|
|
messagebox.showinfo("Downloaded. ", "Thank You..") |
245
|
|
|
elif resolution == 3: |
246
|
|
|
progress_bar = ttk.Progressbar(tab02, |
247
|
|
|
orient='horizontal', |
248
|
|
|
length=500, |
249
|
|
|
mode='determinate') |
250
|
|
|
progress_bar.place(x=70, y=160) |
251
|
|
|
progress_bar.start() |
252
|
|
|
messagebox.showinfo("Download", "Downloading...") |
253
|
|
|
video = yt.streams.get_by_itag(36) |
254
|
|
|
video.download(dirname) |
255
|
|
|
messagebox.showinfo("Downloaded. ", "Thank You..") |
256
|
|
|
|
257
|
|
|
# Download Playlist |
258
|
|
|
if Select == 1: |
259
|
|
|
playlist = pytube.Playlist(var1.get()) |
260
|
|
|
progress_bar = ttk.Progressbar(tab02, |
261
|
|
|
orient='horizontal', |
262
|
|
|
length=500, |
263
|
|
|
mode='determinate') |
264
|
|
|
progress_bar.place(x=70, y=160) |
265
|
|
|
progress_bar.start() |
266
|
|
|
playlist.populate_video_urls() # To load bulk list |
267
|
|
|
messagebox.showinfo("Download", "Downloading...") |
268
|
|
|
playlist.download_all(dirname) |
269
|
|
|
messagebox.showinfo("Downloaded. ", "Thank You..") |
270
|
|
|
|
271
|
|
|
# Audio files |
272
|
|
|
if Selection <= 2: |
273
|
|
|
link = YouTube(var1.get()) |
274
|
|
|
format_a = link.streams.filter(only_audio=True).all() |
275
|
|
|
if Selection == 1: # mp4 |
276
|
|
|
progress_bar = ttk.Progressbar(tab02, |
277
|
|
|
orient='horizontal', |
278
|
|
|
length=500, |
279
|
|
|
mode='determinate') |
280
|
|
|
progress_bar.place(x=70, y=160) |
281
|
|
|
progress_bar.start() |
282
|
|
|
messagebox.showinfo("Download", "Downloading...") |
283
|
|
|
format_a[0].download(dirname) |
284
|
|
|
messagebox.showinfo("Downloaded. ", "Thank You..") |
285
|
|
|
elif Selection == 2: # webm |
286
|
|
|
progress_bar = ttk.Progressbar(tab02, |
287
|
|
|
orient='horizontal', |
288
|
|
|
length=500, |
289
|
|
|
mode='determinate') |
290
|
|
|
progress_bar.place(x=70, y=160) |
291
|
|
|
progress_bar.start() |
292
|
|
|
messagebox.showinfo("Download", "Downloading...") |
293
|
|
|
format_a[1].download(dirname) |
294
|
|
|
messagebox.showinfo("Downloaded. ", "Thank You..") |
295
|
|
|
messagebox.showinfo("FYIT", "Please Select Valid option") |
296
|
|
|
except Exception as a: |
297
|
|
|
messagebox.showwarning(" FYIT.. ", "Failed") |
298
|
|
|
else: |
299
|
|
|
messagebox.showwarning(" FYIT. ", "Cancelled") |
300
|
|
|
except Exception as a: |
301
|
|
|
messagebox.showwarning(" FYIT. ", "Cancelled") |
302
|
|
|
sys.exit() |
303
|
|
|
|
304
|
|
|
downbtn = Button(tab02, |
305
|
|
|
text="Download", |
306
|
|
|
relief=SOLID, |
307
|
|
|
font=SubFont, |
308
|
|
|
command=get_fetch, |
309
|
|
|
cursor='hand2' ) |
310
|
|
|
downbtn.place(x=500, y=400, width=200, height=30) # Download button tab02 |
311
|
|
|
yt_label = Label(tab02, |
312
|
|
|
text="Enter the Link to Download", |
313
|
|
|
font=large_font, |
314
|
|
|
bg="#0B1D6F", |
315
|
|
|
fg="White") |
316
|
|
|
yt_label.place(x=65, y=65) # Label placed in tab02 |
317
|
|
|
|
318
|
|
|
# -----------------Radio button for video resolution------------------------- |
319
|
|
|
|
320
|
|
|
Rvideo = IntVar() # Variable Daclaraton for Youtube Video (options) |
321
|
|
|
resolution_label = Label(tab02, |
322
|
|
|
text="Video Resolution:", |
323
|
|
|
font=DisFont, |
324
|
|
|
bg="#0B1D6F", |
325
|
|
|
fg="white") |
326
|
|
|
resolution_label.place(x=75, y=200) |
327
|
|
|
R1 = Radiobutton(tab02, |
328
|
|
|
text="Mp4 720", |
329
|
|
|
cursor='hand2', |
330
|
|
|
font=SubFont, |
331
|
|
|
variable=Rvideo, |
332
|
|
|
value=1, |
333
|
|
|
command=Maintenanceworkprocess, |
334
|
|
|
fg=col_show, |
335
|
|
|
bg=yt_col, |
336
|
|
|
activebackground=yt_col, |
337
|
|
|
activeforeground=col_select, |
338
|
|
|
selectcolor=yt_col) |
339
|
|
|
R1.place(x=80, y=240) |
340
|
|
|
|
341
|
|
|
R2 = Radiobutton(tab02, |
342
|
|
|
text="Mp4 360px", |
343
|
|
|
cursor='hand2', |
344
|
|
|
font=SubFont, |
345
|
|
|
variable=Rvideo, |
346
|
|
|
value=2, |
347
|
|
|
fg=col_show, |
348
|
|
|
bg=yt_col, |
349
|
|
|
activebackground=yt_col, |
350
|
|
|
activeforeground=col_select, |
351
|
|
|
selectcolor=yt_col) |
352
|
|
|
R2.place(x=80, y=280) |
353
|
|
|
R3 = Radiobutton(tab02, |
354
|
|
|
text="3gp 144px", |
355
|
|
|
cursor='hand2', |
356
|
|
|
font=SubFont, |
357
|
|
|
variable=Rvideo, |
358
|
|
|
value=3, |
359
|
|
|
command = Maintenanceworkprocess, |
360
|
|
|
fg=col_show, |
361
|
|
|
bg=yt_col, |
362
|
|
|
activebackground=yt_col, |
363
|
|
|
activeforeground=col_select, |
364
|
|
|
selectcolor=yt_col) |
365
|
|
|
R3.place(x=80, y=320) |
366
|
|
|
|
367
|
|
|
# -----------------Radio button for video to Audio---------------------------- |
368
|
|
|
|
369
|
|
|
A_Audio = IntVar() # Variable Daclaraton for Youtube Audio (options) |
370
|
|
|
format_label = Label(tab02, |
371
|
|
|
text="Only Audio:", |
372
|
|
|
font=DisFont, |
373
|
|
|
bg="#0B1D6F", |
374
|
|
|
fg="white") |
375
|
|
|
format_label.place(x=260, y=200) |
376
|
|
|
R4 = Radiobutton(tab02, |
377
|
|
|
text="Mp4 Audio", |
378
|
|
|
cursor='hand2', |
379
|
|
|
font=SubFont, |
380
|
|
|
variable=A_Audio, |
381
|
|
|
value=1, |
382
|
|
|
fg=col_show, |
383
|
|
|
bg=yt_col, |
384
|
|
|
activebackground=yt_col, |
385
|
|
|
activeforeground=col_select, |
386
|
|
|
selectcolor=yt_col) |
387
|
|
|
R4.place(x=265, y=240) |
388
|
|
|
R5 = Radiobutton(tab02, |
389
|
|
|
text="webm", |
390
|
|
|
cursor='hand2', |
391
|
|
|
font=SubFont, |
392
|
|
|
variable=A_Audio, |
393
|
|
|
value=2, |
394
|
|
|
fg=col_show, |
395
|
|
|
bg=yt_col, |
396
|
|
|
activebackground=yt_col, |
397
|
|
|
activeforeground=col_select, |
398
|
|
|
selectcolor=yt_col) |
399
|
|
|
R5.place(x=265, y=280) |
400
|
|
|
|
401
|
|
|
# -----------------Radio button for Playlist video -------------------------- |
402
|
|
|
|
403
|
|
|
A_Video = IntVar() # Variable Daclaraton for Youtube Playlist (options) |
404
|
|
|
list_label = Label(tab02, |
405
|
|
|
text="Download Playlist:", |
406
|
|
|
font=DisFont, |
407
|
|
|
bg="#0B1D6F", |
408
|
|
|
fg="white") |
409
|
|
|
list_label.place(x=415, y=200) |
410
|
|
|
R7 = Radiobutton(tab02, |
411
|
|
|
text="High (Default)", |
412
|
|
|
cursor='hand2', |
413
|
|
|
font=SubFont, |
414
|
|
|
variable=A_Video, |
415
|
|
|
value=1, |
416
|
|
|
fg=col_show, |
417
|
|
|
bg=yt_col, |
418
|
|
|
activebackground=yt_col, |
419
|
|
|
activeforeground=col_select, |
420
|
|
|
selectcolor=yt_col) |
421
|
|
|
R7.place(x=420, y=240) |
422
|
|
|
|
423
|
|
|
# ======================= Facebook Control ================================== |
424
|
|
|
|
425
|
|
|
quit_button = Button(tab01, |
426
|
|
|
text="Quit", |
427
|
|
|
relief=SOLID, |
428
|
|
|
font=SubFont, |
429
|
|
|
cursor='hand2', |
430
|
|
|
command=close_btn) |
431
|
|
|
quit_button.place(x=60, y=400, width=200, height=30) # Quit_button placed in tab01 |
432
|
|
|
|
433
|
|
|
fb_label = Label(tab01, |
434
|
|
|
text="Enter the Link to Download", |
435
|
|
|
font=large_font, |
436
|
|
|
bg="#075C90", |
437
|
|
|
fg="White") |
438
|
|
|
fb_label.place(x=65, y=65) # Label placed in tab01 |
439
|
|
|
|
440
|
|
|
|
441
|
|
|
|
442
|
|
|
|
443
|
|
|
|
444
|
|
|
|
445
|
|
View Code Duplication |
def FacebookDownload(): # FacebookDownloader Main Fuction |
|
|
|
|
446
|
|
|
try: |
447
|
|
|
update_check() |
448
|
|
|
except r.exceptions.HTTPError as err: |
449
|
|
|
messagebox.showinfo("FYIT", "Select Location to Download.") |
450
|
|
|
except r.ConnectionError as e: |
451
|
|
|
messagebox.showinfo("Connection Error", |
452
|
|
|
"Check the Internet Connection") |
453
|
|
|
|
454
|
|
|
try: |
455
|
|
|
html = r.get(var1.get()) |
456
|
|
|
dirname = filedialog.askdirectory(parent=tab01, |
457
|
|
|
initialdir="/", |
458
|
|
|
title='Please select a directory:') |
459
|
|
|
if dirname: |
460
|
|
|
hdvideo_url = re.search('hd_src:"(.+?)"', html.text)[1] |
461
|
|
|
try: |
462
|
|
|
hd_url = hdvideo_url.replace('hd_src:"', '') |
|
|
|
|
463
|
|
|
messagebox.showinfo("FYIT", "[+] Video Started Downloading") |
464
|
|
|
progress_bar = ttk.Progressbar(tab01, |
465
|
|
|
orient='horizontal', |
466
|
|
|
length=500, |
467
|
|
|
mode='determinate') |
468
|
|
|
progress_bar.place(x=60, y=180) |
469
|
|
|
progress_bar.start() |
470
|
|
|
wget.download(hd_url, dirname) |
471
|
|
|
ERASE_LINE = '\x1b[2K' |
472
|
|
|
sys.stdout.write(ERASE_LINE) |
473
|
|
|
messagebox.showinfo("FYIT", "Video downloaded") |
474
|
|
|
progress_bar.stop() |
475
|
|
|
except r.ConnectionError as e: |
476
|
|
|
messagebox.showerror("FYIT", "ConnectionError") |
477
|
|
|
except r.Timeout as e: |
478
|
|
|
messagebox.showinfo("FYIT", "Tomeout") |
479
|
|
|
except r.RequestException as e: |
480
|
|
|
messagebox.showerror("FYIT", "General Error or Invalid URL") |
481
|
|
|
except (KeyboardInterrupt, SystemExit): |
482
|
|
|
messagebox.showinfo("FYIT", "SystemExit") |
483
|
|
|
sys.exit() |
484
|
|
|
except TypeError: |
485
|
|
|
messagebox.showerror("FYIT", "Video May Private or InvalidURL") |
486
|
|
|
except Exception as e: |
487
|
|
|
messagebox.showwarning("FYIT", "Cancelled") |
488
|
|
|
|
489
|
|
|
downbtnfb = Button(tab01, |
490
|
|
|
text="Download", |
491
|
|
|
relief=SOLID, |
492
|
|
|
font=SubFont, |
493
|
|
|
command=FacebookDownload, |
494
|
|
|
cursor='hand2') |
495
|
|
|
downbtnfb.place(x=500, y=400, width=200, height=30) # Download placed in tab01 |
496
|
|
|
|
497
|
|
|
# ======================= About Tab Control =================================== |
498
|
|
|
|
499
|
|
|
def check_it(hyper_link): # About tab Redirect Link (Frame1) |
500
|
|
|
webbrowser.open_new(hyper_link) |
501
|
|
|
|
502
|
|
|
|
503
|
|
|
def find_update(): # Check Software Update - 2 |
504
|
|
|
try: |
505
|
|
|
update_check() |
506
|
|
|
messagebox.showinfo("FYIT", "Thank You.") |
507
|
|
|
except r.ConnectionError as e: |
508
|
|
|
messagebox.showinfo("Connection Error", |
509
|
|
|
"Check the Internet Connection") |
510
|
|
|
except r.exceptions.HTTPError as err: |
511
|
|
|
messagebox.showinfo("FYIT","No Update yet..") |
512
|
|
|
|
513
|
|
|
tab3_style = ttk.Style() |
514
|
|
|
|
515
|
|
|
frame1 = tk.Frame(master=tab3, width=260) # Tab3_Frame1 |
516
|
|
|
frame1.pack(fill=tk.BOTH, side=tk.LEFT, expand=True) |
517
|
|
|
|
518
|
|
|
imge = PhotoImage(file='Assets/side_bar.png') |
519
|
|
|
pht = Label(frame1, image=imge) |
520
|
|
|
pht.pack() |
521
|
|
|
|
522
|
|
|
link_1 = Label(frame1, |
523
|
|
|
text="How to use..?", |
524
|
|
|
font=tab_font, |
525
|
|
|
fg="blue", |
526
|
|
|
bg="#90B3DD", |
527
|
|
|
activeforeground="red", |
528
|
|
|
activebackground="green", |
529
|
|
|
cursor="hand2", |
530
|
|
|
underline=0) |
531
|
|
|
link_1.place(x=20, y=260) |
532
|
|
|
link_1.bind("<Button-1>", |
533
|
|
|
lambda e: check_it()) |
534
|
|
|
|
535
|
|
|
link_2 = Label(frame1, |
536
|
|
|
text="Help..!", |
537
|
|
|
font=tab_font, |
538
|
|
|
fg="blue", |
539
|
|
|
bg="#90B3DD", |
540
|
|
|
activeforeground="red", |
541
|
|
|
activebackground="green", |
542
|
|
|
cursor="hand2", |
543
|
|
|
underline=0) |
544
|
|
|
link_2.place(x=20, y=300) |
545
|
|
|
link_2.bind("<Button-1>", |
546
|
|
|
lambda e: check_it("http://bit.ly/site-fyit")) |
547
|
|
|
|
548
|
|
|
link_3 = Label(frame1, |
549
|
|
|
text="Contact us..", |
550
|
|
|
font=tab_font, |
551
|
|
|
fg="blue", |
552
|
|
|
bg="#90B3DD", |
553
|
|
|
activeforeground="red", |
554
|
|
|
activebackground="green", |
555
|
|
|
cursor="hand2", |
556
|
|
|
underline=0) |
557
|
|
|
link_3.place(x=20, y=340) |
558
|
|
|
link_3.bind("<Button-1>", |
559
|
|
|
lambda e: check_it("https://gitter.im/FYIT-DOWNLOADER/DEV-FYI?utm_source=share-link&utm_medium=link&utm_campaign=share-link")) |
560
|
|
|
|
561
|
|
|
link_4 = Label(frame1, |
562
|
|
|
text="Visit us..", |
563
|
|
|
font=tab_font, |
564
|
|
|
fg="blue", |
565
|
|
|
bg="#90B3DD", |
566
|
|
|
activeforeground="red", |
567
|
|
|
activebackground="green", |
568
|
|
|
cursor="hand2", |
569
|
|
|
underline=0) |
570
|
|
|
link_4.place(x=20, y=380) |
571
|
|
|
link_4.bind("<Button-1>", |
572
|
|
|
lambda e: check_it("http://bit.ly/site-fyit")) |
573
|
|
|
|
574
|
|
|
link_5 = Button(frame1, |
575
|
|
|
text="Check Update..", |
576
|
|
|
font=tab_font, |
577
|
|
|
command=find_update, |
578
|
|
|
fg="blue", |
579
|
|
|
bg="#90B3DD", |
580
|
|
|
activeforeground="red", |
581
|
|
|
activebackground="#90B3DD", |
582
|
|
|
cursor="hand2", |
583
|
|
|
relief=FLAT, |
584
|
|
|
underline=0) |
585
|
|
|
link_5.place(x=20, y=420) |
586
|
|
|
link_5.config(highlightthickness=0) |
587
|
|
|
|
588
|
|
|
frame2 = HtmlFrame(master=tab3, width=640, horizontal_scrollbar="auto") # Tab3_Frame2 |
589
|
|
|
frame2.pack(fill=tk.BOTH, side=tk.LEFT, expand=True) |
590
|
|
|
|
591
|
|
|
frame2.set_content(open("Assets/help.html", "r").read()) |
592
|
|
|
#--------Maintenance Work-----------------# |
593
|
|
|
|
594
|
|
|
infinity = 1 |
595
|
|
|
while infinity == 1: |
596
|
|
|
for i in range(500): |
597
|
|
|
xpos = i |
598
|
|
|
label.place(x=xpos, y=20) |
599
|
|
|
time.sleep(0.01) |
600
|
|
|
if (xpos == 500): |
601
|
|
|
xpos = 0 |
602
|
|
|
tab02.update() |
603
|
|
|
|
604
|
|
|
|
605
|
|
|
top.mainloop() |
606
|
|
|
|
607
|
|
|
# ----------------------------- Close Function ------------------------------- |
608
|
|
|
|
609
|
|
|
def on_close(): |
610
|
|
|
top.destroy() |
611
|
|
|
sys.exit() |
612
|
|
|
|
613
|
|
|
top.protocol("WM_DELETE_WINDOW", on_close) |
614
|
|
|
|
615
|
|
|
# ---------------------------------------------------------------------------- |
616
|
|
|
|