diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-04-27 17:02:04 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-04-28 08:42:18 +0200 |
commit | e6c345f890c076eabd438274db1df8ce39315e78 (patch) | |
tree | aeeb8cba4520d607c66c91b3d05881d7a5af9542 /searx | |
parent | ecee56533c318bd3ead0dfdaf74568836ccec12e (diff) | |
download | searxng-e6c345f890c076eabd438274db1df8ce39315e78.tar.gz searxng-e6c345f890c076eabd438274db1df8ce39315e78.zip |
[fix] ccc_media engine: filter video formats and ignore audio & SubRip
CCC media serves several recording formats, to name a few:
- application/x-subrip
- video/mp4
- video/webm
- audio/mpeg
- audio/opus
- audio/mpeg
not all of them are suitable for a video frame. If available we should prefer
video/mp4 due to its minimal data rates.
Closes: https://github.com/searxng/searxng/issues/3431
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/ccc_media.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/searx/engines/ccc_media.py b/searx/engines/ccc_media.py index 1b5235220..34fe811df 100644 --- a/searx/engines/ccc_media.py +++ b/searx/engines/ccc_media.py @@ -35,8 +35,13 @@ def response(resp): publishedDate = parser.parse(item['date']) iframe_src = None - if len(item['recordings']) > 0: - iframe_src = item['recordings'][0]['recording_url'] + for rec in item['recordings']: + if rec['mime_type'].startswith('video'): + if not iframe_src: + iframe_src = rec['recording_url'] + elif rec['mime_type'] == 'video/mp4': + # prefer mp4 (minimal data rates) + iframe_src = rec['recording_url'] results.append( { |