.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
emojipedia.py
Go to the documentation of this file.
1# SPDX-License-Identifier: AGPL-3.0-or-later
2"""Emojipedia
3
4Emojipedia is an emoji reference website which documents the meaning and
5common usage of emoji characters in the Unicode Standard. It is owned by Zedge
6since 2021. Emojipedia is a voting member of The Unicode Consortium.[1]
7
8[1] https://en.wikipedia.org/wiki/Emojipedia
9"""
10
11from urllib.parse import urlencode
12from lxml import html
13
14from searx.utils import (
15 eval_xpath_list,
16 extract_text,
17)
18
19about = {
20 "website": 'https://emojipedia.org',
21 "wikidata_id": 'Q22908129',
22 "official_api_documentation": None,
23 "use_official_api": False,
24 "require_api_key": False,
25 "results": 'HTML',
26}
27
28categories = []
29
30base_url = 'https://emojipedia.org'
31search_url = base_url + '/search?{query}'
32
33
34def request(query, params):
35 params['url'] = search_url.format(
36 query=urlencode({'q': query}),
37 )
38 return params
39
40
41def response(resp):
42 results = []
43
44 dom = html.fromstring(resp.text)
45
46 for result in eval_xpath_list(dom, '//div[starts-with(@class, "EmojisList")]/a'):
47
48 url = base_url + result.attrib.get('href')
49 res = {'url': url, 'title': extract_text(result), 'content': ''}
50
51 results.append(res)
52
53 return results
request(query, params)
Definition emojipedia.py:34