.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.freesound Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 

Variables

bool disabled = True
 
str api_key = ""
 
dict about
 
bool paging = True
 
str url = "https://freesound.org/apiv2/"
 
tuple search_url
 

Detailed Description

Freesound (Sound)

Function Documentation

◆ request()

searx.engines.freesound.request ( query,
params )

Definition at line 34 of file freesound.py.

34def request(query, params):
35 params["url"] = search_url.format(
36 query=urlencode({"q": query}),
37 page=params["pageno"],
38 api_key=api_key,
39 )
40 return params
41
42
43# get response from search request

◆ response()

searx.engines.freesound.response ( resp)

Definition at line 44 of file freesound.py.

44def response(resp):
45 results = []
46 search_res = loads(resp.text)
47 # parse results
48 for result in search_res.get("results", []):
49 title = result["name"]
50 content = result["description"][:128]
51 publishedDate = datetime.fromisoformat(result["created"])
52 uri = result["download"]
53
54 # append result
55 results.append(
56 {
57 "url": result["url"],
58 "title": title,
59 "publishedDate": publishedDate,
60 "audio_src": uri,
61 "content": content,
62 }
63 )
64
65 return results

Variable Documentation

◆ about

dict searx.engines.freesound.about
Initial value:
1= {
2 "website": "https://freesound.org",
3 "wikidata_id": "Q835703",
4 "official_api_documentation": "https://freesound.org/docs/api",
5 "use_official_api": True,
6 "require_api_key": True,
7 "results": "JSON",
8}

Definition at line 14 of file freesound.py.

◆ api_key

str searx.engines.freesound.api_key = ""

Definition at line 11 of file freesound.py.

◆ disabled

bool searx.engines.freesound.disabled = True

Definition at line 10 of file freesound.py.

◆ paging

bool searx.engines.freesound.paging = True

Definition at line 24 of file freesound.py.

◆ search_url

tuple searx.engines.freesound.search_url
Initial value:
1= (
2 url + "search/text/?query={query}&page={page}&fields=name,url,download,created,description,type&token={api_key}"
3)

Definition at line 28 of file freesound.py.

◆ url

str searx.engines.freesound.url = "https://freesound.org/apiv2/"

Definition at line 27 of file freesound.py.