title: Scrape only hyperlinks that end .ece from an html page using beautifulsoup
body: <p>I wrote a code to scrape only hyperlinks that end with <code>.ecm</code>, here is my code</p>
  
  <pre><code>_URL='http://www.thehindu.com/archive/web/2017/08/08/'
  r = requests.get(_URL)
  soup = BeautifulSoup(r.text)
  urls = []
  names = []
  newpath=r'D:\fyp\data set'
  os.chdir(newpath)
  name='testecmlinks'
  for i, link in enumerate(soup.findAll('a')):
      _FULLURL = _URL + link.get('href')
      if _FULLURL.endswith('.ece'):
          urls.append(_FULLURL)
          names.append(soup.select('a')[i].attrs['href'])
  
  names_urls = zip(names, urls)
  
  for name, url in names_urls:
      print url
      rq = urllib2.Request(url)
      res = urllib2.urlopen(rq)
      pdf = open(name+'.txt', 'wb')
      pdf.write(res.read())
      pdf.close()
  </code></pre>
  
  <p>But I get the following error</p>
  
  <pre><code>Traceback (most recent call last):
    File "D:/fyp/scripts/test.py", line 18, in &lt;module&gt;
      _FULLURL = _URL + link.get('href')
  TypeError: cannot concatenate 'str' and 'NoneType' objects
  </code></pre>
  
  <p>Can you help me get hyperlinks ending with <code>.ece</code>?</p>