.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

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 79 of file tagesschau.py.

79def _story(item):
80 return {
81 'title': item['title'],
82 'thumbnail': item.get('teaserImage', {}).get('imageVariants', {}).get('16x9-256'),
83 'publishedDate': datetime.strptime(item['date'][:19], '%Y-%m-%dT%H:%M:%S'),
84 'content': item['firstSentence'],
85 'url': item['shareURL'] if use_source_url else item['detailsweb'],
86 }
87
88

Referenced by response().

Here is the caller graph for this function:

◆ _video()

searx.engines.tagesschau._video ( item)
protected

Definition at line 89 of file tagesschau.py.

89def _video(item):
90 streams = item['streams']
91 video_url = streams.get('h264s') or streams.get('h264m') or streams.get('h264l') or streams.get('h264xl')
92 title = item['title']
93
94 if "_vapp.mxf" in title:
95 title = title.replace("_vapp.mxf", "")
96 title = re.sub(r"APP\d+ (FC-)?", "", title, count=1)
97
98 # sometimes, only adaptive m3u8 streams are available, so video_url is None
99 url = video_url or f"{base_url}/multimedia/video/{item['sophoraId']}.html"
100
101 return {
102 'template': 'videos.html',
103 'title': title,
104 'thumbnail': item.get('teaserImage', {}).get('imageVariants', {}).get('16x9-256'),
105 'publishedDate': datetime.strptime(item['date'][:19], '%Y-%m-%dT%H:%M:%S'),
106 'content': item.get('firstSentence', ''),
107 'iframe_src': video_url,
108 'url': url,
109 }

Referenced by response().

Here is the caller graph for this function:

◆ request()

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

Definition at line 50 of file tagesschau.py.

50def request(query, params):
51 args = {
52 'searchText': query,
53 'pageSize': results_per_page,
54 'resultPage': params['pageno'] - 1,
55 }
56
57 params['url'] = f"{base_url}/api2u/search?{urlencode(args)}"
58
59 return params
60
61

◆ response()

searx.engines.tagesschau.response ( resp)

Definition at line 62 of file tagesschau.py.

62def response(resp):
63 results = []
64
65 json = resp.json()
66
67 for item in json['searchResults']:
68 item_type = item.get('type')
69 if item_type in ('story', 'webview'):
70 results.append(_story(item))
71 elif item_type == 'video':
72 results.append(_video(item))
73 else:
74 logger.error("unknown result type: %s", item_type)
75
76 return results
77
78

References _story(), and _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 23 of file tagesschau.py.

◆ base_url

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

Definition at line 36 of file tagesschau.py.

◆ categories

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

Definition at line 32 of file tagesschau.py.

◆ paging

bool searx.engines.tagesschau.paging = True

Definition at line 33 of file tagesschau.py.

◆ results_per_page

int searx.engines.tagesschau.results_per_page = 10

Definition at line 35 of file tagesschau.py.

◆ use_source_url

bool searx.engines.tagesschau.use_source_url = True

Definition at line 38 of file tagesschau.py.