mirror of
				https://github.com/searxng/searxng.git
				synced 2025-10-31 10:37:06 -04:00 
			
		
		
		
	In 25.1.0 [2] an old bug has been fixed: "Docstring formatting does not apply to module docstrings" [3]. [1] https://github.com/psf/black/blob/main/CHANGES.md#2590 [2] https://github.com/psf/black/blob/main/CHANGES.md#2510 [3] https://github.com/psf/black/issues/4094 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # SPDX-License-Identifier: AGPL-3.0-or-later
 | |
| """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.fromtimestamp(result['newestItemPubdate']),
 | |
|                 'metadata': f"{result['author']}, {result['episodeCount']} episodes",
 | |
|             }
 | |
|         )
 | |
| 
 | |
|     return results
 |