import os os.system('pip install -qq yt-dlp -U') from yt_dlp import YoutubeDL def url_download(url): outtmpl = url[-5:] + '.mp4' ydl_opts = {'format': 'bestvideo[ext=mp4]+bestaudio[ext=mp4]/mp4+best[height<=144]', 'outtmpl': outtmpl} with YoutubeDL(ydl_opts) as ydl: ydl.extract_info(url, download=True) return outtmpl