import os import subprocess import tempfile def download_html_with_wget(url): with tempfile.NamedTemporaryFile(delete=False) as tmp_file: tmp_file_name = tmp_file.name command = ['wget', '-q', '-O', tmp_file_name, url] try: subprocess.run(command, check=True) with open(tmp_file_name, 'r') as file: content = file.read() return content except subprocess.CalledProcessError as e: print(f'An error occurred: {e}') return None finally: if os.path.exists(tmp_file_name): os.remove(tmp_file_name)