summaryrefslogtreecommitdiff
path: root/searx/engines/podcastindex.py
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2023-09-30 14:13:12 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-12-11 18:55:16 +0100
commit527e13ab4622d84830cb06a469250a0ae8c5303d (patch)
tree6be0d360180aedb8d4aa6f4f7d6126b3a0319abc /searx/engines/podcastindex.py
parent3bc85c511ce58d61aea4f5a2e8043643ec8da62a (diff)
downloadsearxng-527e13ab4622d84830cb06a469250a0ae8c5303d.tar.gz
searxng-527e13ab4622d84830cb06a469250a0ae8c5303d.zip
[feat] engine: implementation of podcastindex.org
Diffstat (limited to 'searx/engines/podcastindex.py')
-rw-r--r--searx/engines/podcastindex.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/searx/engines/podcastindex.py b/searx/engines/podcastindex.py
new file mode 100644
index 000000000..7f1e2cd02
--- /dev/null
+++ b/searx/engines/podcastindex.py
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: AGPL-3.0-or-later
+# lint: pylint
+"""Podcast Index
+"""
+
+from urllib.parse import quote_plus
+from datetime import datetime
+
+about = {
+ 'website': 'https://podcastindex.org',
+ 'official_api_documentation': None, # requires an account
+ 'use_official_api': False,
+ 'require_api_key': False,
+ 'results': 'JSON',
+}
+categories = []
+
+base_url = "https://podcastindex.org"
+
+
+def request(query, params):
+ params['url'] = f"{base_url}/api/search/byterm?q={quote_plus(query)}"
+ return params
+
+
+def response(resp):
+ results = []
+
+ json = resp.json()
+
+ for result in json['feeds']:
+ results.append(
+ {
+ 'url': result['link'],
+ 'title': result['title'],
+ 'content': result['description'],
+ 'thumbnail': result['image'],
+ 'publishedDate': datetime.utcfromtimestamp(result['newestItemPubdate']),
+ 'metadata': f"{result['author']}, {result['episodeCount']} episodes",
+ }
+ )
+
+ return results