mirror of
https://github.com/bellingcat/facebook-downloader.git
synced 2026-06-12 13:38:30 +03:00
Compare commits
4 Commits
2022.1.0.0
...
2022.1.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bad245ae7 | ||
|
|
cec70c0600 | ||
|
|
d734cba88c | ||
|
|
7cf8a2f74c |
@@ -6,6 +6,8 @@ from tqdm import tqdm
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions
|
||||
|
||||
|
||||
option = webdriver.FirefoxOptions()
|
||||
@@ -13,12 +15,12 @@ option.add_argument('--headless')
|
||||
driver = webdriver.Firefox(options=option)
|
||||
program_version_number = "2022.1.0.0"
|
||||
downloading_url = "https://getfvid.com"
|
||||
update_check_endpoint = "https://api.github.com/repos/rly0nheart/Facebook-Downloader/releases/latest"
|
||||
update_check_endpoint = "https://api.github.com/repos/rly0nheart/facebook-downloader/releases/latest"
|
||||
|
||||
|
||||
def notice():
|
||||
notice_msg = f"""
|
||||
Facebook-Downloader {program_version_number} Copyright (C) 2022 Richard Mwewa
|
||||
facebook-downloader {program_version_number} Copyright (C) 2022 Richard Mwewa
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -39,7 +41,7 @@ def check_and_get_updates():
|
||||
if update_prompt.lower() == "y":
|
||||
files_to_update = ['downloader.py', 'geckodriver.exe', 'README.md', 'requirements.txt']
|
||||
for file in tqdm(files_to_update, desc=f'Updating'):
|
||||
data = requests.get(f'https://raw.githubusercontent.com/rly0nheart/Facebook-Downloader/master/{file}')
|
||||
data = requests.get(f'https://raw.githubusercontent.com/rly0nheart/facebook-downloader/master/{file}')
|
||||
with open(file, "wb") as f:
|
||||
f.write(data.content)
|
||||
f.close()
|
||||
@@ -63,7 +65,7 @@ def download_video(url, output):
|
||||
Audio: "/html/body/div[2]/div/div/div[1]/div/div[2]/div/div[3]/p[3]/a"
|
||||
"""
|
||||
|
||||
download_btn = driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div[1]/div/div[2]/div/div[3]/p[1]/a') # Find the download button (this clicks the first button which returns a video in hd)
|
||||
download_btn = WebDriverWait(driver, 20).until(expected_conditions.presence_of_element_located((By.XPATH, '/html/body/div[2]/div/div/div[1]/div/div[2]/div/div[3]/p[1]/a'))) # Find the download button (this clicks the first button which returns a video in hd)
|
||||
download_url = download_btn.get_attribute('href')
|
||||
|
||||
with requests.get(download_url, stream=True) as response:
|
||||
@@ -75,7 +77,7 @@ def download_video(url, output):
|
||||
driver.close()
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='Facebook-Downloader — by Richard Mwewa')
|
||||
parser = argparse.ArgumentParser(description='facebook-downloader — by Richard Mwewa')
|
||||
parser.add_argument('url', help='facebook video url (eg. https://www.facebook.com/PageName/videos/VideoID')
|
||||
parser.add_argument('-A', '--audio', help=argparse.SUPPRESS, action='store_true')
|
||||
parser.add_argument('-o', '--output', help='output filename')
|
||||
@@ -94,4 +96,5 @@ if __name__ == "__main__":
|
||||
print('Process interrupted with Ctrl+C.')
|
||||
|
||||
except Exception as e:
|
||||
print('An error occured:', e)
|
||||
print('An error occured:', e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user