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

Unverified Commit 033f39bf authored by Alexandre Flament's avatar Alexandre Flament Committed by GitHub
Browse files

Merge pull request #2376 from dalf/fix-mojeek

Fix mojeek
parents 6bc6d5e9 0ba74cd8
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -7,7 +7,6 @@ url_xpath = None
content_xpath = None
content_xpath = None
title_xpath = None
title_xpath = None
thumbnail_xpath = False
thumbnail_xpath = False
categories = []
paging = False
paging = False
suggestion_xpath = ''
suggestion_xpath = ''
results_xpath = ''
results_xpath = ''
@@ -39,7 +38,7 @@ def request(query, params):
def response(resp):
def response(resp):
    results = []
    results = []
    dom = html.fromstring(resp.text)
    dom = html.fromstring(resp.text)
    is_onion = True if 'onions' in categories else False
    is_onion = True if 'onions' in categories else False  # pylint: disable=undefined-variable


    if results_xpath:
    if results_xpath:
        for result in eval_xpath_list(dom, results_xpath):
        for result in eval_xpath_list(dom, results_xpath):
+3 −2
Original line number Original line Diff line number Diff line
@@ -309,10 +309,11 @@ class ResultContainer:


        for res in results:
        for res in results:
            # FIXME : handle more than one category per engine
            # FIXME : handle more than one category per engine
            res['category'] = engines[res['engine']].categories[0]
            engine = engines[res['engine']]
            res['category'] = engine.categories[0] if len(engine.categories) > 0 else ''


            # FIXME : handle more than one category per engine
            # FIXME : handle more than one category per engine
            category = engines[res['engine']].categories[0]\
            category = res['category']\
                + ':' + res.get('template', '')\
                + ':' + res.get('template', '')\
                + ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')
                + ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')