import subprocess video_urls = [] with open("channel_urls.txt", "r") as f: channel_urls = f.readlines() for channel_url in channel_urls: command = ["yt-dlp", "--flat-playlist", "--print-to-file", "webpage_url", "urls.txt", channel_url] subprocess.run(command)