URL: https://www.nytimes.com/
编写一个Python程序，从给定的新闻页面获取前5条头条新闻。
import requests
from bs4 import BeautifulSoup

# 指定 URL
url = 'https://www.nytimes.com/'

# 发送请求
response = requests.get(url)

# 解析 HTML 内容
soup = BeautifulSoup(response.content,'html.parser')

# 查找所有头条新闻
headlines = soup.find_all('h2', class_='esl82me0')

# 打印前5条头条新闻
print('The New York Times前五条头条新闻：')
for head in headlines[:5]:
    print(head.text)