Updated downloader.py and README.md

This commit is contained in:
Richard Mwewa
2022-09-24 16:28:59 +02:00
parent 1e103a3f16
commit 8d1b7a66b7
2 changed files with 8 additions and 3 deletions

View File

@@ -53,6 +53,7 @@ python downloader.py https://www.facebook.com/PageName/videos/VideoID
| *-A/--audio* | download audio only (coming soon) |
| *-o/--output* | output filename |
| *-v/--version* | show program's version number and exit |
| *-d/--debug* | enable debug mode |
# Donations
If you would like to donate, you could Buy A Coffee for the developer using the button below

View File

@@ -46,7 +46,7 @@ class FacebookDownloader:
with open(file, "wb") as f:
f.write(data.content)
f.close()
exit(f"Updated: Re-run program.")
logging.info(f"Updated: Re-run program.")
else:
pass
@@ -82,8 +82,12 @@ parser = argparse.ArgumentParser(description='Facebook-Downloader — by Richard
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')
parser.add_argument('-d', '--debug', help='enable debug mode', action='store_true')
args = parser.parse_args()
logging.basicConfig(format='[%(asctime)s] %(levelname)s: %(message)s', datefmt='%I:%M:%S%p', level='NOTSET')
if args.debug:
logging.basicConfig(format='[%(asctime)s] %(message)s', datefmt='%I:%M:%S%p', level=logging.DEBUG)
else:
logging.basicConfig(format='[%(asctime)s] %(message)s', datefmt='%I:%M:%S%p', level=logging.INFO)
if __name__ == "__main__":
try:
@@ -93,4 +97,4 @@ if __name__ == "__main__":
logging.warning('Process interrupted with Ctrl+C.')
except Exception as e:
logging.error(e)
logging.error(f'An error occured: {e}')