summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authornaughtymommy42069 <204327539+naughtymommy42069@users.noreply.github.com>2025-03-21 04:54:25 -0600
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-03-30 12:41:43 +0200
commitc8b419fcbb937e1f3da45dddbc4edc6b64d43d2c (patch)
treeb7f1f5ab027dd13ebaad23fc1360916c2354d962 /searx
parent237267ffbed78524feeabae737e6ea62de59d9ae (diff)
[feat] engine: add bitchute
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/bitchute.py56
-rw-r--r--searx/settings.yml5
2 files changed, 61 insertions, 0 deletions
diff --git a/searx/engines/bitchute.py b/searx/engines/bitchute.py
new file mode 100644
index 000000000..88170c949
--- /dev/null
+++ b/searx/engines/bitchute.py
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: AGPL-3.0-or-later
+"""bitchute (Videos)"""
+
+from json import dumps
+from datetime import datetime
+from searx.utils import html_to_text
+
+about = {
+ "website": 'https://bitchute.com',
+ "wikidata_id": "Q45287179",
+ "official_api_documentation": None,
+ "use_official_api": False,
+ "require_api_key": False,
+ "results": "JSON",
+}
+
+base_url = "https://api.bitchute.com/api/beta/search/videos"
+categories = ['videos']
+paging = True
+results_per_page = 20
+
+
+def request(query, params):
+
+ start_index = (params["pageno"] - 1) * results_per_page
+ data = {"offset": start_index, "limit": results_per_page, "query": query, "sensitivity_id": "normal", "sort": "new"}
+ params["url"] = base_url
+ params["method"] = 'POST'
+ params['headers']['content-type'] = "application/json"
+ params['data'] = dumps(data)
+
+ return params
+
+
+def response(resp):
+ search_res = resp.json()
+ results = []
+
+ for item in search_res.get('videos', []):
+
+ results.append(
+ {
+ "title": item['video_name'],
+ "url": 'https://www.bitchute.com/video/' + item['video_id'],
+ "content": html_to_text(item['description']),
+ "author": item['channel']['channel_name'],
+ "publishedDate": datetime.strptime(item["date_published"], "%Y-%m-%dT%H:%M:%S.%fZ"),
+ "length": item['duration'],
+ "views": item['view_count'],
+ "thumbnail": item['thumbnail_url'],
+ "iframe_src": 'https://www.bitchute.com/embed/' + item['video_id'],
+ "template": "videos.html",
+ }
+ )
+
+ return results
diff --git a/searx/settings.yml b/searx/settings.yml
index a0b898448..dc9e6277a 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -560,6 +560,11 @@ engines:
engine: bing_videos
shortcut: biv
+ - name: bitchute
+ engine: bitchute
+ shortcut: bit
+ disabled: true
+
- name: bitbucket
engine: xpath
paging: true