def get_title(soup):
 if soup.title:
  return soup.title.string
 if soup.h1:
  return soup.h1.string
 return u''

def get_title ( soup ) : if soup . title : return soup . title . string if soup . h1 : return soup . h1 . string return u''
fetch the contents of url and try to extract the pages title .