forked from Ponysearch/Ponysearch
[feat] engine: implementation of podcastindex.org
This commit is contained in:
parent
3bc85c511c
commit
527e13ab46
2 changed files with 47 additions and 0 deletions
43
searx/engines/podcastindex.py
Normal file
43
searx/engines/podcastindex.py
Normal file
|
@ -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
|
|
@ -1288,6 +1288,10 @@ engines:
|
||||||
url: https://thepiratebay.org/
|
url: https://thepiratebay.org/
|
||||||
timeout: 3.0
|
timeout: 3.0
|
||||||
|
|
||||||
|
- name: podcastindex
|
||||||
|
engine: podcastindex
|
||||||
|
shortcut: podcast
|
||||||
|
|
||||||
# Required dependency: psychopg2
|
# Required dependency: psychopg2
|
||||||
# - name: postgresql
|
# - name: postgresql
|
||||||
# engine: postgresql
|
# engine: postgresql
|
||||||
|
|
Loading…
Reference in a new issue