diff options
author | singletail <t@wse.nyc> | 2024-04-10 13:56:07 -0400 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-04-13 08:41:00 +0200 |
commit | 1746eecf2bd4d566bf3d440d9efbff75b68d7d42 (patch) | |
tree | 76b571fcdd281af561571eaf1e44b17df74af53c /searx | |
parent | c92846dca894a97459fe99e43e0bdd060f116744 (diff) | |
download | searxng-1746eecf2bd4d566bf3d440d9efbff75b68d7d42.tar.gz searxng-1746eecf2bd4d566bf3d440d9efbff75b68d7d42.zip |
[fix] engine: youtube_api - ignore channels / prevent exceptions
`youtube_api.py` throws an exception if the search results contain a channel, as
channels have no videoId. This PR adds a keycheck for parsing the json response.
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/youtube_api.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/searx/engines/youtube_api.py b/searx/engines/youtube_api.py index 25ad2cb04..4192530b9 100644 --- a/searx/engines/youtube_api.py +++ b/searx/engines/youtube_api.py @@ -56,6 +56,10 @@ def response(resp): # parse results for result in search_results['items']: + if "videoId" not in result["id"]: + # ignore channels + continue + videoid = result['id']['videoId'] title = result['snippet']['title'] |