input: Write a function to scrape an online news website and extract the headlines. The function should take the URL of the website as input and return a list of headlines.
  import requests
  from bs4 import BeautifulSoup
  
  def get_headlines(url):
      r = requests.get(url)
      soup = BeautifulSoup(r.content, 'html5lib')
      headlines = soup.find_all('h2')
      return [headline.text for headline in headlines]
  
  assert get_headlines("https://www.news.com/")==['Example Headline 1', 'Example Headline 2']
  assert get_headlines("https://www.anothernews.com/")==['Another Example Headline 1', 'Another Example Headline 2']
  assert get_headlines("https://www.nonexistenturl.com/")==[]
output: def get_headlines(url):
      r = requests.get(url)
      soup = BeautifulSoup(r.content, 'html5lib')
      headlines = soup.find_all('h2')
      return [headline.text for headline in headlines]