| @@ 445-487 (lines=43) @@ | ||
| 442 | ||
| 443 | ||
| 444 | ||
| 445 | 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", |
|
| @@ 427-469 (lines=43) @@ | ||
| 424 | fg="White") |
|
| 425 | fb_label.place(x=65, y=65) # Label placed in Tab2 |
|
| 426 | ||
| 427 | def FacebookDownload(): # FacebookDownloader Main Fuction |
|
| 428 | try: |
|
| 429 | update_check() |
|
| 430 | except r.exceptions.HTTPError as err: |
|
| 431 | messagebox.showinfo("FYIT", "Select Location to Download.") |
|
| 432 | except r.ConnectionError as e: |
|
| 433 | messagebox.showinfo("Connection Error", |
|
| 434 | "Check the Internet Connection") |
|
| 435 | ||
| 436 | try: |
|
| 437 | html = r.get(var1.get()) |
|
| 438 | dirname = filedialog.askdirectory(parent=tab2, |
|
| 439 | initialdir="/", |
|
| 440 | title='Please select a directory:') |
|
| 441 | if dirname: |
|
| 442 | hdvideo_url = re.search('hd_src:"(.+?)"', html.text)[1] |
|
| 443 | try: |
|
| 444 | hd_url = hdvideo_url.replace('hd_src:"', '') |
|
| 445 | messagebox.showinfo("FYIT", "[+] Video Started Downloading") |
|
| 446 | progress_bar = ttk.Progressbar(tab2, |
|
| 447 | orient='horizontal', |
|
| 448 | length=500, |
|
| 449 | mode='determinate') |
|
| 450 | progress_bar.place(x=60, y=180) |
|
| 451 | progress_bar.start() |
|
| 452 | wget.download(hd_url, dirname) |
|
| 453 | ERASE_LINE = '\x1b[2K' |
|
| 454 | sys.stdout.write(ERASE_LINE) |
|
| 455 | messagebox.showinfo("FYIT", "Video downloaded") |
|
| 456 | progress_bar.stop() |
|
| 457 | except r.ConnectionError as e: |
|
| 458 | messagebox.showerror("FYIT", "ConnectionError") |
|
| 459 | except r.Timeout as e: |
|
| 460 | messagebox.showinfo("FYIT", "Tomeout") |
|
| 461 | except r.RequestException as e: |
|
| 462 | messagebox.showerror("FYIT", "General Error or Invalid URL") |
|
| 463 | except (KeyboardInterrupt, SystemExit): |
|
| 464 | messagebox.showinfo("FYIT", "SystemExit") |
|
| 465 | sys.exit() |
|
| 466 | except TypeError: |
|
| 467 | messagebox.showerror("FYIT", "Video May Private or InvalidURL") |
|
| 468 | except Exception as e: |
|
| 469 | messagebox.showwarning("FYIT", "Cancelled") |
|
| 470 | ||
| 471 | downbtnfb = Button(tab2, |
|
| 472 | text="Download", |
|