From 303432fc687183f70cdc0abb551e2e732545d29d Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Sat, 18 Jul 2015 01:22:40 +0200 Subject: [PATCH] Also use css expressions for textSearch. --- dosagelib/scraper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dosagelib/scraper.py b/dosagelib/scraper.py index 835afc53b..b9492f9da 100644 --- a/dosagelib/scraper.py +++ b/dosagelib/scraper.py @@ -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: