import requests
import os

# Set the YouTube video ID
video_id = “abcdefghijkl”

# Set the thumbnail resolution
thumbnail_resolution = “maxresdefault”

# Construct the thumbnail URL
thumbnail_url = f”https://img.youtube.com/vi/{video_id}/{thumbnail_resolution}.jpg”

# Send a request to the thumbnail URL
response = requests.get(thumbnail_url)

# Save the thumbnail to a file
with open(“thumbnail.jpg”, “wb”) as f:
f.write(response.content)