.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
fyyd.py
Go to the documentation of this file.
1# SPDX-License-Identifier: AGPL-3.0-or-later
2"""Fyyd (podcasts)
3"""
4
5from datetime import datetime
6from urllib.parse import urlencode
7
8about = {
9 'website': 'https://fyyd.de',
10 'official_api_documentation': 'https://github.com/eazyliving/fyyd-api',
11 'use_official_api': True,
12 'require_api_key': False,
13 'results': 'JSON',
14}
15categories = []
16paging = True
17
18base_url = "https://api.fyyd.de"
19page_size = 10
20
21
22def request(query, params):
23 args = {
24 'term': query,
25 'count': page_size,
26 'page': params['pageno'] - 1,
27 }
28 params['url'] = f"{base_url}/0.2/search/podcast?{urlencode(args)}"
29 return params
30
31
32def response(resp):
33 results = []
34
35 json_results = resp.json()['data']
36
37 for result in json_results:
38 results.append(
39 {
40 'url': result['htmlURL'],
41 'title': result['title'],
42 'content': result['description'],
43 'thumbnail': result['smallImageURL'],
44 'publishedDate': datetime.strptime(result['status_since'], '%Y-%m-%d %H:%M:%S'),
45 'metadata': f"Rank: {result['rank']} || {result['episode_count']} episodes",
46 }
47 )
48
49 return results
request(query, params)
Definition fyyd.py:22
response(resp)
Definition fyyd.py:32