def authors(self): byline = self.soup.find('div', 'byline') # for some reason the mail is not connected to the # name, but we can fix that. authors = [] for address, li in izip(byline.find_all('address'), byline.find_all('li', 'icon-email')): author = Author() author.name = address.find(class_='fn').string # NRK is still trying to hide the email address # from spammers. href = li.a['href'] author.mail = unquote(href[21:-1])[7:] author.role = address.find(class_='role').string.strip() authors.append(author) return authors
def test_authors(self): author = Author() author.name = u'Håkon Rysst Heilmann' author.mail = u'*****@*****.**' author.role = u'Journalist' self.assertEquals(author, self.analyser.authors()[0])