.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
mixcloud.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: AGPL-3.0-or-later
2
"""Mixcloud (Music)
3
4
"""
5
6
from
urllib.parse
import
urlencode
7
from
dateutil
import
parser
8
9
# about
10
about = {
11
"website"
:
'https://www.mixcloud.com/'
,
12
"wikidata_id"
:
'Q6883832'
,
13
"official_api_documentation"
:
'http://www.mixcloud.com/developers/'
,
14
"use_official_api"
:
True
,
15
"require_api_key"
:
False
,
16
"results"
:
'JSON'
,
17
}
18
19
# engine dependent config
20
categories = [
'music'
]
21
paging =
True
22
23
# search-url
24
url =
'https://api.mixcloud.com/'
25
search_url = url +
'search/?{query}&type=cloudcast&limit=10&offset={offset}'
26
iframe_src =
"https://www.mixcloud.com/widget/iframe/?feed={url}"
27
28
29
def
request
(query, params):
30
offset = (params[
'pageno'
] - 1) * 10
31
params[
'url'
] = search_url.format(query=urlencode({
'q'
: query}), offset=offset)
32
return
params
33
34
35
def
response
(resp):
36
results = []
37
search_res = resp.json()
38
39
for
result
in
search_res.get(
'data'
, []):
40
41
r_url = result[
'url'
]
42
publishedDate = parser.parse(result[
'created_time'
])
43
res = {
44
'url'
: r_url,
45
'title'
: result[
'name'
],
46
'iframe_src'
: iframe_src.format(url=r_url),
47
'thumbnail'
: result[
'pictures'
][
'medium'
],
48
'publishedDate'
: publishedDate,
49
'content'
: result[
'user'
][
'name'
],
50
}
51
results.append(res)
52
53
return
results
searx.engines.mixcloud.response
response(resp)
Definition
mixcloud.py:35
searx.engines.mixcloud.request
request(query, params)
Definition
mixcloud.py:29
searxng
searx
engines
mixcloud.py
Generated on Sat Nov 16 2024 00:10:57 for .oO SearXNG Developer Documentation Oo. by
1.12.0