diff --git a/searx/engines/youtube_noapi.py b/searx/engines/youtube_noapi.py index fb9d76b65c0e91cad2f10bf8996395dc3b42a4b6..caba565920e8ed2ab50fecead3682521496a183f 100644 --- a/searx/engines/youtube_noapi.py +++ b/searx/engines/youtube_noapi.py @@ -47,6 +47,7 @@ def request(query, params): try: lang, region = params['language'].split('-') except: + lang = 'en' region = 'us' if not params['engine_data'].get('next_page_token'): params['url'] = search_url.format(query=quote_plus(query), page=params['pageno'], region=region, lang=lang) diff --git a/searx/webapp.py b/searx/webapp.py index 4df5c9fc347bdcdd7eb8ec7545db457c0f90eca6..a568146490e44905d1a1e83bcac6d506d2e77d4c 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -368,6 +368,9 @@ def proxify(url): def image_proxify(url): + if not isinstance(url, str): + return None + if url.startswith('//'): url = 'https:' + url @@ -1008,6 +1011,8 @@ def image_proxy(): max_redirects=20) resp = next(stream) + if resp is None: + return '', 400 content_length = resp.headers.get('Content-Length') if content_length and content_length.isdigit() and int(content_length) > maximum_size: return 'Max size', 400