.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.tagesschau Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 
 _story (item)
 
 _video (item)
 

Variables

logging logger .Logger
 
dict about
 
list categories = ['general', 'news']
 
bool paging = True
 
int results_per_page = 10
 
str base_url = "https://www.tagesschau.de"
 
bool use_source_url = True
 

Detailed Description

ARD: `Tagesschau API`_

The Tagesschau is a news program of the ARD.  Via the `Tagesschau API`_, current
news and media reports are available in JSON format.  The `Bundesstelle für Open
Data`_ offers a `OpenAPI`_ portal at bundDEV_ where APIs are documented an can
be tested.

This SearXNG engine uses the `/api2u/search`_ API.

.. _/api2u/search: http://tagesschau.api.bund.dev/
.. _bundDEV: https://bund.dev/apis
.. _Bundesstelle für Open Data: https://github.com/bundesAPI
.. _Tagesschau API: https://github.com/AndreasFischer1985/tagesschau-api/blob/main/README_en.md
.. _OpenAPI: https://swagger.io/specification/

Function Documentation

◆ _story()

searx.engines.tagesschau._story ( item)
protected

Definition at line 85 of file tagesschau.py.

85def _story(item):
86 return {
87 'title': item['title'],
88 'thumbnail': item.get('teaserImage', {}).get('imageVariants', {}).get('16x9-256'),
89 'publishedDate': datetime.strptime(item['date'][:19], '%Y-%m-%dT%H:%M:%S'),
90 'content': item['firstSentence'],
91 'url': item['shareURL'] if use_source_url else item['detailsweb'],
92 }
93
94

Referenced by searx.engines.tagesschau.response().

+ Here is the caller graph for this function:

◆ _video()

searx.engines.tagesschau._video ( item)
protected

Definition at line 95 of file tagesschau.py.

95def _video(item):
96 streams = item['streams']
97 video_url = streams.get('h264s') or streams.get('h264m') or streams.get('h264l') or streams.get('h264xl')
98 title = item['title']
99
100 if "_vapp.mxf" in title:
101 title = title.replace("_vapp.mxf", "")
102 title = re.sub(r"APP\d+ (FC-)?", "", title, count=1)
103
104 return {
105 'template': 'videos.html',
106 'title': title,
107 'thumbnail': item.get('teaserImage', {}).get('imageVariants', {}).get('16x9-256'),
108 'publishedDate': datetime.strptime(item['date'][:19], '%Y-%m-%dT%H:%M:%S'),
109 'content': item.get('firstSentence', ''),
110 'iframe_src': video_url,
111 'url': video_url,
112 }

Referenced by searx.engines.tagesschau.response().

+ Here is the caller graph for this function:

◆ request()

searx.engines.tagesschau.request ( query,
params )

Definition at line 56 of file tagesschau.py.

56def request(query, params):
57 args = {
58 'searchText': query,
59 'pageSize': results_per_page,
60 'resultPage': params['pageno'] - 1,
61 }
62
63 params['url'] = f"{base_url}/api2u/search?{urlencode(args)}"
64
65 return params
66
67

◆ response()

searx.engines.tagesschau.response ( resp)

Definition at line 68 of file tagesschau.py.

68def response(resp):
69 results = []
70
71 json = resp.json()
72
73 for item in json['searchResults']:
74 item_type = item.get('type')
75 if item_type in ('story', 'webview'):
76 results.append(_story(item))
77 elif item_type == 'video':
78 results.append(_video(item))
79 else:
80 logger.error("unknow result type: %s", item_type)
81
82 return results
83
84

References searx.engines.tagesschau._story(), and searx.engines.tagesschau._video().

+ Here is the call graph for this function:

Variable Documentation

◆ about

dict searx.engines.tagesschau.about
Initial value:
1= {
2 'website': "https://tagesschau.de",
3 'wikidata_id': "Q703907",
4 'official_api_documentation': None,
5 'use_official_api': True,
6 'require_api_key': False,
7 'results': 'JSON',
8 'language': 'de',
9}

Definition at line 29 of file tagesschau.py.

◆ base_url

str searx.engines.tagesschau.base_url = "https://www.tagesschau.de"

Definition at line 42 of file tagesschau.py.

◆ categories

list searx.engines.tagesschau.categories = ['general', 'news']

Definition at line 38 of file tagesschau.py.

◆ logger

logging searx.engines.tagesschau.logger .Logger

Definition at line 27 of file tagesschau.py.

◆ paging

bool searx.engines.tagesschau.paging = True

Definition at line 39 of file tagesschau.py.

◆ results_per_page

int searx.engines.tagesschau.results_per_page = 10

Definition at line 41 of file tagesschau.py.

◆ use_source_url

bool searx.engines.tagesschau.use_source_url = True

Definition at line 44 of file tagesschau.py.