mirror of
https://github.com/searxng/searxng.git
synced 2026-09-25 23:56:05 +00:00
[mod] migration of some engine results to the video class (#6743)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
committed by
Markus Heiser
parent
ce48993997
commit
2e41cf7407
@@ -20,6 +20,8 @@ from datetime import datetime
|
||||
from urllib.parse import urlencode
|
||||
import re
|
||||
|
||||
from searx.result_types import Video
|
||||
|
||||
about = {
|
||||
'website': "https://tagesschau.de",
|
||||
'wikidata_id': "Q703907",
|
||||
@@ -87,7 +89,7 @@ def _story(item):
|
||||
}
|
||||
|
||||
|
||||
def _video(item):
|
||||
def _video(item) -> Video:
|
||||
streams = item['streams']
|
||||
video_url = streams.get('h264s') or streams.get('h264m') or streams.get('h264l') or streams.get('h264xl')
|
||||
title = item['title']
|
||||
@@ -99,12 +101,11 @@ def _video(item):
|
||||
# sometimes, only adaptive m3u8 streams are available, so video_url is None
|
||||
url = video_url or f"{base_url}/multimedia/video/{item['sophoraId']}.html"
|
||||
|
||||
return {
|
||||
'template': 'videos.html',
|
||||
'title': title,
|
||||
'thumbnail': item.get('teaserImage', {}).get('imageVariants', {}).get('16x9-256'),
|
||||
'publishedDate': datetime.fromisoformat(item['date'][:19]),
|
||||
'content': item.get('firstSentence', ''),
|
||||
'iframe_src': video_url,
|
||||
'url': url,
|
||||
}
|
||||
return Video(
|
||||
title=title,
|
||||
thumbnail=item.get('teaserImage', {}).get('imageVariants', {}).get('16x9-256'),
|
||||
publishedDate=datetime.fromisoformat(item['date'][:19]),
|
||||
content=item.get('firstSentence', ''),
|
||||
iframe_src=video_url,
|
||||
url=url,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user