Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2744520 authored by Markus Heiser's avatar Markus Heiser Committed by Markus Heiser
Browse files

[mod] google: support for showing the answer source url

parent 5ec7df34
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -331,11 +331,13 @@ def response(resp):

    # results --> answer
    answer_list = eval_xpath(dom, '//div[contains(@class, "LGOjhe")]')
    if answer_list:
        answer_list = [_.xpath("normalize-space()") for _ in answer_list]
        results.append({'answer': ' '.join(answer_list)})
    else:
        logger.debug("did not find 'answer'")
    for item in answer_list:
        results.append(
            {
                'answer': item.xpath("normalize-space()"),
                'url': (eval_xpath(item, '../..//a/@href') + [None])[0],
            }
        )

    # parse results