I will add frontend to make this useable on the blog for everyone rather than just in this notebook later.

import json, requests, getpass, sys

class color:
    BOLD = '\033[91m'
    UNDERLINE = '\033[91m'
    END = '\033[0m'
# This doesn't really work except make things red, don't know why

print(color.BOLD + "YouTube Video Downloader with APIs: \n" + color.END)

apiFound = False

while apiFound == False:
    
    print(color.UNDERLINE + "Enter a valid YouTube Video URL or ID:" + color.END)
    videoURL = input("Enter a valid YouTube Video URL or ID:")
    videoID = videoURL[-11:]

    print(getpass.getuser() + ": " + videoURL)
    
    url = "https://ytstream-download-youtube-videos.p.rapidapi.com/dl"

    querystring = {"id":videoID}

    headers = {
        "X-RapidAPI-Key": "e51c67fa22mshec43200baacf5b3p148027jsn10e3e84c629e",
        "X-RapidAPI-Host": "ytstream-download-youtube-videos.p.rapidapi.com"
    }

    response = requests.request("GET", url, headers=headers, params=querystring)

    json = response.json()

    if json['status'] == "fail":
        print(color.BOLD + "\nYou have inputted an invalid YouTube ID, please try again.\n" + color.END)
    else:
        apiFound = True
    
formatList = json.get('formats')

qualityFound = False

while qualityFound == False:    
    print(color.UNDERLINE + "\nAvailable qualities:" + color.END)
    
    i = 2

    while i >= 0:
        print(formatList[i]['qualityLabel'])
        i -= 1
        
    print("Note: 144p is " + color.BOLD + "AUDIO-ONLY" + color.END)
    
    print(color.UNDERLINE + "\nEnter chosen quality (from the list):" + color.END)
    chosenQuality = input("Enter chosen quality (from the list)")
    print(getpass.getuser() + ": " + chosenQuality)
    chosenQuality.lower()

    downloadURL = 0

    if chosenQuality == formatList[0]['qualityLabel']:
        downloadURL = 0
        qualityFound = True
        
    elif chosenQuality == formatList[1]['qualityLabel']:
        downloadURL = 1
        qualityFound = True
        
    elif chosenQuality == formatList[2]['qualityLabel']:
        downloadURL = 2
        qualityFound = True
        
    else:
        print(color.BOLD + "\nThe selected resolution is not available, please try again." + color.END)
        
print(color.UNDERLINE + "\nDownload link:\n" +formatList[downloadURL]['url'] + color.END + "\n\nTo download, click on the three dots in the bottom-right then press download.")
YouTube Video Downloader with APIs: 

Enter a valid YouTube Video URL or ID:
Aiden: https://www.youtube.com/watch?v=TApmI8YtYhc

Available qualities:
144p
360p
720p
Note: 144p is AUDIO-ONLY

Enter chosen quality (from the list):
Aiden: 

The selected resolution is not available, please try again.

Available qualities:
144p
360p
720p
Note: 144p is AUDIO-ONLY

Enter chosen quality (from the list):
Aiden: 720p

Download link:
https://rr5---sn-4g5edns6.googlevideo.com/videoplayback?expire=1665633762&ei=gjlHY9jRAZqy1wK45qGADQ&ip=23.88.39.196&id=o-AFKqeirNm7pBz-qtDw5uSZ_D3elyevEQf-n9Y6w3bR8Z&itag=22&source=youtube&requiressl=yes&mh=KX&mm=31%2C29&mn=sn-4g5edns6%2Csn-4g5lznez&ms=au%2Crdu&mv=m&mvi=5&pl=26&initcwndbps=282500&vprv=1&svpuc=1&mime=video%2Fmp4&cnr=14&ratebypass=yes&dur=3.134&lmt=1630135775777054&mt=1665611831&fvip=3&fexp=24001373%2C24007246&c=ANDROID&txp=5311224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Csvpuc%2Cmime%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIgYCqH0FduYsIW4JcOIHh5xZ2r0KWTxifgEXKIWCSoUF4CIQDTRUhB15r0QljszhXWoY7-EcvgO8ejS72TmIvw8_dPkA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgKFiwJ7fK4qGudS8wcyOjcGxbSR1z4qxmBuROzt83OfgCIBc-Yn0sbcrF0uzKoLLreDgflqrsmbIQsu9U6_RgDMvh

To download, click on the three dots in the bottom-right then press download.