Also use css expressions for textSearch.

This commit is contained in:
Tobias Gruetzmacher 2015-07-18 01:22:40 +02:00
parent 6a70bf4671
commit 303432fc68

View file

@ -451,9 +451,13 @@ class _ParserScraper(Scraper):
@classmethod
def fetchText(cls, url, data, textSearch, optional):
"""Search text entry for given text XPath in a HTML page."""
if cls.css:
searchFun = data.cssselect
else:
searchFun = data.xpath
if textSearch:
text = ''
for match in data.xpath(textSearch):
for match in searchFun(textSearch):
try:
text += ' ' + match.text_content()
except AttributeError: