I use this code to get all names:
def parse_authors(self, root):
author_nodes = root.xpath('//a[@class="booklink"][contains(@href,"/author/")]/text()')
if author_nodes:
return [unicode(author) for author in author_nodes]
But i want if there are any translators to add "(translation)" next to their names:
example:translator1(translation)
You can use that
translation:
text node to distinguish authors from translators - authors are preceding siblings of the "translation:" text node, translators - following siblings.Authors:
Translators:
Working sample code:
Prints: