.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
mediathekviewweb.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: AGPL-3.0-or-later
2
"""MediathekViewWeb (API)
3
4
"""
5
6
import
datetime
7
from
json
import
loads, dumps
8
9
about = {
10
"website"
:
'https://mediathekviewweb.de/'
,
11
"wikidata_id"
:
'Q27877380'
,
12
"official_api_documentation"
:
'https://gist.github.com/bagbag/a2888478d27de0e989cf777f81fb33de'
,
13
"use_official_api"
:
True
,
14
"require_api_key"
:
False
,
15
"results"
:
'JSON'
,
16
"language"
:
"de"
,
17
}
18
19
categories = [
'videos'
]
20
paging =
True
21
time_range_support =
False
22
safesearch =
False
23
24
25
def
request
(query, params):
26
27
params[
'url'
] =
'https://mediathekviewweb.de/api/query'
28
params[
'method'
] =
'POST'
29
params[
'headers'
][
'Content-type'
] =
'text/plain'
30
params[
'data'
] = dumps(
31
{
32
'queries'
: [
33
{
34
'fields'
: [
35
'title'
,
36
'topic'
,
37
],
38
'query'
: query,
39
},
40
],
41
'sortBy'
:
'timestamp'
,
42
'sortOrder'
:
'desc'
,
43
'future'
:
True
,
44
'offset'
: (params[
'pageno'
] - 1) * 10,
45
'size'
: 10,
46
}
47
)
48
return
params
49
50
51
def
response
(resp):
52
53
resp = loads(resp.text)
54
55
mwv_result = resp[
'result'
]
56
mwv_result_list = mwv_result[
'results'
]
57
58
results = []
59
60
for
item
in
mwv_result_list:
61
62
item[
'hms'
] = str(datetime.timedelta(seconds=item[
'duration'
]))
63
64
results.append(
65
{
66
'url'
: item[
'url_video_hd'
].replace(
"http://"
,
"https://"
),
67
'title'
:
"%(channel)s: %(title)s (%(hms)s)"
% item,
68
'length'
: item[
'hms'
],
69
'content'
:
"%(description)s"
% item,
70
'iframe_src'
: item[
'url_video_hd'
].replace(
"http://"
,
"https://"
),
71
'template'
:
'videos.html'
,
72
}
73
)
74
75
return
results
searx.engines.mediathekviewweb.request
request(query, params)
Definition
mediathekviewweb.py:25
searx.engines.mediathekviewweb.response
response(resp)
Definition
mediathekviewweb.py:51
searxng
searx
engines
mediathekviewweb.py
Generated on Sat Nov 16 2024 00:10:57 for .oO SearXNG Developer Documentation Oo. by
1.12.0