INNER CODE UNIT · Python
download_file
SamurAIGPT/Text-To-Video-AI · app.py:30
def download_file(url, filename):
print(f"[Pipeline] Downloading: {url} -> {filename}")
with open(filename, 'wb') as f:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
f.write(response.content)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate a video from a topic.")
parser.add_argument("topic", type=str, help="The topic for the video")
args = parser.parse_args()
config = get_config()
orientation_landscape = config.get_video_orientation()
aspect_ratio = "16:9" if orientation_landscape else "9:16"