Downloads a file from the given URL and saves it to the specified location.
Args:
url (str): The URL of the file to download.
filename (str, optional): The name of the file to save. If not provided, the filename will be extracted from the URL or the response header. Defaults to None.
save_path (str, optional): The directory path to save the file. Defaults to '.' (current directory).
cookies (dict, optional): A dictionary of cookies to include in the request. Defaults to None.
session (requests.Session, optional): A requests Session object to use for the request. Defaults to None.
dry_run (bool, optional): If True, only prints the URL and does not perform the actual download. Defaults to False.
dupe (str, optional): The method to handle duplicate files. Must be one of 'skip', 'overwrite', 'rename', or 'skip_same_size'. Defaults to 'skip_same_size'.
referer (str, optional): The referer header to include in the request. Defaults to None.
headers (dict, optional): Additional headers to include in the request. Defaults to None.
placeholder (bool, optional): If True, creates a placeholder file with a '.broken' extension if the download fails. Defaults to True.
prefix (str, optional): A prefix to add to the filename. Useful when fetching the filename from the response headers. Defaults to ''.
get_suffix (bool, optional): If True, attempts to determine the file extension from the response headers. Defaults to True.
verbose (int, optional): The verbosity level of the download progress. Must be 0, 1, or 2. Defaults to 2.
retry_failed (bool, optional): If True, retries the download if it fails. Defaults to True.
Returns:
str: The status of the download. Can be 'Dry run', 'Exists', or the HTTP status code.