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