| @@ 198-302 (lines=105) @@ | ||
| 195 | text="YoutubeDownloader is Under Maintenance", |
|
| 196 | font=cust_font, bg="#1B1B19", fg="#ffffff") |
|
| 197 | ||
| 198 | 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", |
|
| @@ 188-292 (lines=105) @@ | ||
| 185 | "New Update is Availabe, Click yes to install.") is True: |
|
| 186 | openweb() |
|
| 187 | ||
| 188 | def get_fetch(): |
|
| 189 | resolution = Rvideo.get() |
|
| 190 | Select = A_Video.get() |
|
| 191 | Selection = A_Audio.get() |
|
| 192 | ||
| 193 | try: |
|
| 194 | update_check() |
|
| 195 | except r.exceptions.HTTPError as err: |
|
| 196 | messagebox.showinfo("FYIT", "Select Location to Save the File.") |
|
| 197 | except r.ConnectionError as e: |
|
| 198 | messagebox.showinfo("Connection Error", "Check the Internet Connection") |
|
| 199 | ||
| 200 | try: |
|
| 201 | if var1 is None: |
|
| 202 | print("error") |
|
| 203 | dirname = filedialog.askdirectory(parent=tab1, |
|
| 204 | initialdir="/", |
|
| 205 | title='Please select a directory:') |
|
| 206 | if dirname: |
|
| 207 | try: |
|
| 208 | # Youtube Video with Resolution |
|
| 209 | if resolution <= 3: |
|
| 210 | yt = pytube.YouTube(var1.get()) |
|
| 211 | if resolution == 1: |
|
| 212 | progress_bar = ttk.Progressbar(tab1, |
|
| 213 | orient='horizontal', |
|
| 214 | length=500, |
|
| 215 | mode='determinate') |
|
| 216 | progress_bar.place(x=70, y=160) |
|
| 217 | progress_bar.start() |
|
| 218 | messagebox.showinfo( |
|
| 219 | "Download", |
|
| 220 | "Downloading.. Please Wait for a Minute.") |
|
| 221 | video = yt.streams.get_by_itag(22) |
|
| 222 | video.download(dirname) |
|
| 223 | messagebox.showinfo("Downloaded. ", "Thank You..") |
|
| 224 | elif resolution == 2: |
|
| 225 | progress_bar = ttk.Progressbar(tab1, |
|
| 226 | orient='horizontal', |
|
| 227 | length=500, |
|
| 228 | mode='determinate') |
|
| 229 | progress_bar.place(x=70, y=160) |
|
| 230 | progress_bar.start() |
|
| 231 | messagebox.showinfo("Download", "Downloading...") |
|
| 232 | video = yt.streams.first() |
|
| 233 | video.download(dirname) |
|
| 234 | messagebox.showinfo("Downloaded. ", "Thank You..") |
|
| 235 | elif resolution == 3: |
|
| 236 | progress_bar = ttk.Progressbar(tab1, |
|
| 237 | orient='horizontal', |
|
| 238 | length=500, |
|
| 239 | mode='determinate') |
|
| 240 | progress_bar.place(x=70, y=160) |
|
| 241 | progress_bar.start() |
|
| 242 | messagebox.showinfo("Download", "Downloading...") |
|
| 243 | video = yt.streams.get_by_itag(36) |
|
| 244 | video.download(dirname) |
|
| 245 | messagebox.showinfo("Downloaded. ", "Thank You..") |
|
| 246 | ||
| 247 | # Download Playlist |
|
| 248 | if Select == 1: |
|
| 249 | playlist = pytube.Playlist(var1.get()) |
|
| 250 | progress_bar = ttk.Progressbar(tab1, |
|
| 251 | orient='horizontal', |
|
| 252 | length=500, |
|
| 253 | mode='determinate') |
|
| 254 | progress_bar.place(x=70, y=160) |
|
| 255 | progress_bar.start() |
|
| 256 | playlist.populate_video_urls() # To load bulk list |
|
| 257 | messagebox.showinfo("Download", "Downloading...") |
|
| 258 | playlist.download_all(dirname) |
|
| 259 | messagebox.showinfo("Downloaded. ", "Thank You..") |
|
| 260 | ||
| 261 | # Audio files |
|
| 262 | if Selection <= 2: |
|
| 263 | link = YouTube(var1.get()) |
|
| 264 | format_a = link.streams.filter(only_audio=True).all() |
|
| 265 | if Selection == 1: # mp4 |
|
| 266 | progress_bar = ttk.Progressbar(tab1, |
|
| 267 | orient='horizontal', |
|
| 268 | length=500, |
|
| 269 | mode='determinate') |
|
| 270 | progress_bar.place(x=70, y=160) |
|
| 271 | progress_bar.start() |
|
| 272 | messagebox.showinfo("Download", "Downloading...") |
|
| 273 | format_a[0].download(dirname) |
|
| 274 | messagebox.showinfo("Downloaded. ", "Thank You..") |
|
| 275 | elif Selection == 2: # webm |
|
| 276 | progress_bar = ttk.Progressbar(tab1, |
|
| 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[1].download(dirname) |
|
| 284 | messagebox.showinfo("Downloaded. ", "Thank You..") |
|
| 285 | messagebox.showinfo("FYIT", "Please Select Valid option") |
|
| 286 | except Exception as a: |
|
| 287 | messagebox.showwarning(" FYIT.. ", "Failed") |
|
| 288 | else: |
|
| 289 | messagebox.showwarning(" FYIT. ", "Cancelled") |
|
| 290 | except Exception as a: |
|
| 291 | messagebox.showwarning(" FYIT. ", "Cancelled") |
|
| 292 | sys.exit() |
|
| 293 | ||
| 294 | downbtn = Button(tab1, |
|
| 295 | text="Download", |
|