.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
ccc_media.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: AGPL-3.0-or-later
2
"""media.ccc.de"""
3
4
import
datetime
5
from
urllib.parse
import
urlencode
6
7
from
dateutil
import
parser
8
9
about = {
10
'website'
:
'https://media.ccc.de'
,
11
'official_api_documentation'
:
'https://github.com/voc/voctoweb'
,
12
'use_official_api'
:
True
,
13
'require_api_key'
:
False
,
14
'results'
:
'JSON'
,
15
}
16
categories = [
'videos'
]
17
paging =
True
18
19
api_url =
"https://api.media.ccc.de"
20
21
22
def
request
(query, params):
23
args = {
'q'
: query,
'page'
: params[
'pageno'
]}
24
params[
'url'
] = f
"{api_url}/public/events/search?{urlencode(args)}"
25
26
return
params
27
28
29
def
response
(resp):
30
results = []
31
32
for
item
in
resp.json()[
'events'
]:
33
publishedDate =
None
34
if
item.get(
'date'
):
35
publishedDate = parser.parse(item[
'date'
])
36
37
iframe_src =
None
38
for
rec
in
item[
'recordings'
]:
39
if
rec[
'mime_type'
].startswith(
'video'
):
40
if
not
iframe_src:
41
iframe_src = rec[
'recording_url'
]
42
elif
rec[
'mime_type'
] ==
'video/mp4'
:
43
# prefer mp4 (minimal data rates)
44
iframe_src = rec[
'recording_url'
]
45
46
results.append(
47
{
48
'template'
:
'videos.html'
,
49
'url'
: item[
'frontend_link'
],
50
'title'
: item[
'title'
],
51
'content'
: item[
'description'
],
52
'thumbnail'
: item[
'thumb_url'
],
53
'publishedDate'
: publishedDate,
54
'length'
: datetime.timedelta(seconds=item[
'length'
]),
55
'iframe_src'
: iframe_src,
56
}
57
)
58
59
return
results
searx.engines.ccc_media.response
response(resp)
Definition
ccc_media.py:29
searx.engines.ccc_media.request
request(query, params)
Definition
ccc_media.py:22
searxng
searx
engines
ccc_media.py
Generated on Sat Nov 16 2024 00:10:57 for .oO SearXNG Developer Documentation Oo. by
1.12.0