From fe9386b58d491ce3ba439d2984d71f45ca8702ed Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 30 Sep 2023 19:58:39 +0200 Subject: [PATCH] [fix] emojipedia: fix engine --- searx/engines/emojipedia.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/searx/engines/emojipedia.py b/searx/engines/emojipedia.py index 020bf689b..a1f3ef7b8 100644 --- a/searx/engines/emojipedia.py +++ b/searx/engines/emojipedia.py @@ -14,7 +14,6 @@ from lxml import html from searx.utils import ( eval_xpath_list, - eval_xpath_getindex, extract_text, ) @@ -28,11 +27,9 @@ about = { } categories = [] -paging = False -time_range_support = False base_url = 'https://emojipedia.org' -search_url = base_url + '/search/?{query}' +search_url = base_url + '/search?{query}' def request(query, params): @@ -47,20 +44,10 @@ def response(resp): dom = html.fromstring(resp.text) - for result in eval_xpath_list(dom, "//ol[@class='search-results']/li"): + for result in eval_xpath_list(dom, '//div[starts-with(@class, "EmojisList")]/a'): - extracted_desc = extract_text(eval_xpath_getindex(result, './/p', 0)) - - if 'No results found.' in extracted_desc: - break - - link = eval_xpath_getindex(result, './/h2/a', 0) - - url = base_url + link.attrib.get('href') - title = extract_text(link) - content = extracted_desc - - res = {'url': url, 'title': title, 'content': content} + url = base_url + result.attrib.get('href') + res = {'url': url, 'title': extract_text(result), 'content': ''} results.append(res)