.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
podcastindex.py
Go to the documentation of this file.
1# SPDX-License-Identifier: AGPL-3.0-or-later
2"""Podcast Index
3"""
4
5from urllib.parse import quote_plus
6from datetime import datetime
7
8about = {
9 'website': 'https://podcastindex.org',
10 'official_api_documentation': None, # requires an account
11 'use_official_api': False,
12 'require_api_key': False,
13 'results': 'JSON',
14}
15categories = []
16
17base_url = "https://podcastindex.org"
18
19
20def request(query, params):
21 params['url'] = f"{base_url}/api/search/byterm?q={quote_plus(query)}"
22 return params
23
24
25def response(resp):
26 results = []
27
28 json = resp.json()
29
30 for result in json['feeds']:
31 results.append(
32 {
33 'url': result['link'],
34 'title': result['title'],
35 'content': result['description'],
36 'thumbnail': result['image'],
37 'publishedDate': datetime.utcfromtimestamp(result['newestItemPubdate']),
38 'metadata': f"{result['author']}, {result['episodeCount']} episodes",
39 }
40 )
41
42 return results