import subprocess
import requests
# Replace with your username and password
username = "your_username"
password = "your_password"
# Replace with the URL of the website you want to download
website_url = "http://example.com/"
# Replace with the directory where you want to save the downloaded files
download_directory = "C:/path/to/save"
# Authenticate using requests library
session = requests.Session()
login_payload = {
"username": username,
"password": password
}
session.post("http://example.com/login", data=login_payload)
# Use wget to download pages recursively
subprocess.run(["wget", "--recursive", "--no-clobber", "--page-requisites", "--convert-links", "--no-parent", "--directory-prefix", download_directory, "--load-cookies", session.cookies.filename(), website_url])