input: Write a function to scrape an online news website to get the headlines. The function should take a URL as input and return a list of headlines from the website.
  
  import requests
  from bs4 import BeautifulSoup 
  
  def get_headlines(url): 
      # get the response in the form of html
      r = requests.get(url) 
  
      # create a beautifulsoup object to parse contents 
      soup = BeautifulSoup(r.content, 'html5lib') 
  
      # find headlines from the parsed page  
      headlines = soup.find_all('h2') 
  
      # return the list of headlines 
      return [headline.text for headline in headlines]
  
  assert get_headlines("https://www.example-news.com/") == ["Example Headline 1", "Example Headline 2"]
  assert get_headlines("https://www.another-news.com/") == ["Another Headline 1", "Another Headline 2"]
  assert get_headlines("https://www.third-news.com/") == []
  assert get_headlines("https://www.invalid-url.com/") == []
output: def get_headlines(url): 
      try:
          r = requests.get(url) 
          soup = BeautifulSoup(r.content, 'html5lib') 
          headlines = soup.find_all('h2') 
          return [headline.text for headline in headlines]
      except:
          return []