.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
bitchute.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: AGPL-3.0-or-later
2
"""bitchute (Videos)"""
3
4
from
json
import
dumps
5
from
datetime
import
datetime
6
from
searx.utils
import
html_to_text
7
8
about = {
9
"website"
:
'https://bitchute.com'
,
10
"wikidata_id"
:
"Q45287179"
,
11
"official_api_documentation"
:
None
,
12
"use_official_api"
:
False
,
13
"require_api_key"
:
False
,
14
"results"
:
"JSON"
,
15
}
16
17
base_url =
"https://api.bitchute.com/api/beta/search/videos"
18
categories = [
'videos'
]
19
paging =
True
20
results_per_page = 20
21
22
23
def
request
(query, params):
24
25
start_index = (params[
"pageno"
] - 1) * results_per_page
26
data = {
"offset"
: start_index,
"limit"
: results_per_page,
"query"
: query,
"sensitivity_id"
:
"normal"
,
"sort"
:
"new"
}
27
params[
"url"
] = base_url
28
params[
"method"
] =
'POST'
29
params[
'headers'
][
'content-type'
] =
"application/json"
30
params[
'data'
] = dumps(data)
31
32
return
params
33
34
35
def
response
(resp):
36
search_res = resp.json()
37
results = []
38
39
for
item
in
search_res.get(
'videos'
, []):
40
41
results.append(
42
{
43
"title"
: item[
'video_name'
],
44
"url"
:
'https://www.bitchute.com/video/'
+ item[
'video_id'
],
45
"content"
: html_to_text(item[
'description'
]),
46
"author"
: item[
'channel'
][
'channel_name'
],
47
"publishedDate"
: datetime.strptime(item[
"date_published"
],
"%Y-%m-%dT%H:%M:%S.%fZ"
),
48
"length"
: item[
'duration'
],
49
"views"
: item[
'view_count'
],
50
"thumbnail"
: item[
'thumbnail_url'
],
51
"iframe_src"
:
'https://www.bitchute.com/embed/'
+ item[
'video_id'
],
52
"template"
:
"videos.html"
,
53
}
54
)
55
56
return
results
searx.engines.bitchute.request
request(query, params)
Definition
bitchute.py:23
searx.engines.bitchute.response
response(resp)
Definition
bitchute.py:35
searx.utils
Definition
utils.py:1
searxng
searx
engines
bitchute.py
Generated on Mon Mar 31 2025 23:37:38 for .oO SearXNG Developer Documentation Oo. by
1.13.2