input: Write a python function to scrape news articles from the New York Times homepage and return a list of dictionaries containing the title, author, date, and link of each article.
  assert len(scrape_nytimes()) > 0
  assert isinstance(scrape_nytimes()[0], dict)
  assert "title" in scrape_nytimes()[0]
  assert "author" in scrape_nytimes()[0]
  assert "date" in scrape_nytimes()[0]
  assert "link" in scrape_nytimes()[0]
output: import requests
  from bs4 import BeautifulSoup
  from datetime import datetime
  
  def scrape_nytimes():
      url = 'https://www.nytimes.com/'
      response = requests.get(url)
      soup = BeautifulSoup(response.content, 'html.parser')
      
      articles = []
      
      for item in soup.find_all('article'):
          title_element = item.find('h2')
          link_element = item.find('a')
          author_element = item.find('span', class_='css-1n7hynb')
          date_element = item.find('time')
          
          if title_element and link_element:
              title = title_element.get_text()
              link = link_element['href']
              if not link.startswith('http'):
                  link = 'https://www.nytimes.com' + link
              author = author_element.get_text() if author_element else 'Unknown'
              date = date_element['datetime'] if date_element else datetime.now().isoformat()
  
              articles.append({
                  'title': title,
                  'author': author,
                  'date': date,
                  'link': link
              })
      
      return articles