.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
vimeo.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: AGPL-3.0-or-later
2
"""
3
Wikipedia (Web
4
"""
5
6
from
urllib.parse
import
urlencode
7
from
json
import
loads
8
from
dateutil
import
parser
9
10
from
searx.utils
import
extr
11
12
# about
13
about = {
14
"website"
:
'https://vimeo.com/'
,
15
"wikidata_id"
:
'Q156376'
,
16
"official_api_documentation"
:
'http://developer.vimeo.com/api'
,
17
"use_official_api"
:
False
,
18
"require_api_key"
:
False
,
19
"results"
:
'HTML'
,
20
}
21
22
# engine dependent config
23
categories = [
'videos'
]
24
paging =
True
25
26
# search-url
27
base_url =
'https://vimeo.com/'
28
search_url = base_url +
'search/page:{pageno}?{query}'
29
30
31
# do search-request
32
def
request
(query, params):
33
params[
'url'
] = search_url.format(pageno=params[
'pageno'
], query=urlencode({
'q'
: query}))
34
35
return
params
36
37
38
# get response from search-request
39
def
response
(resp):
40
results = []
41
42
data = loads(extr(resp.text,
'var data = '
,
';\n'
))
43
44
# parse results
45
for
result
in
data[
'filtered'
][
'data'
]:
46
result = result[result[
'type'
]]
47
videoid = result[
'uri'
].split(
'/'
)[-1]
48
url = base_url + videoid
49
title = result[
'name'
]
50
thumbnail = result[
'pictures'
][
'sizes'
][-1][
'link'
]
51
publishedDate = parser.parse(result[
'created_time'
])
52
53
# append result
54
results.append(
55
{
56
'url'
: url,
57
'title'
: title,
58
'content'
:
''
,
59
'template'
:
'videos.html'
,
60
'publishedDate'
: publishedDate,
61
'iframe_src'
:
"https://player.vimeo.com/video/"
+ videoid,
62
'thumbnail'
: thumbnail,
63
}
64
)
65
66
# return results
67
return
results
searx.engines.vimeo.request
request(query, params)
Definition
vimeo.py:32
searx.engines.vimeo.response
response(resp)
Definition
vimeo.py:39
searx.utils
Definition
utils.py:1
searxng
searx
engines
vimeo.py
Generated on Sat Nov 16 2024 00:10:57 for .oO SearXNG Developer Documentation Oo. by
1.12.0