mirror of
https://github.com/searxng/searxng.git
synced 2026-01-13 18:15:30 +00:00
[fix] google: switch to using GSA for iPhone useragent
This commit is contained in:
@@ -25,7 +25,7 @@ from lxml.etree import XPath, XPathError, XPathSyntaxError
|
||||
from lxml.etree import ElementBase, _Element # pyright: ignore[reportPrivateUsage]
|
||||
|
||||
from searx import settings
|
||||
from searx.data import USER_AGENTS, data_dir
|
||||
from searx.data import USER_AGENTS, data_dir, gsa_useragents_loader
|
||||
from searx.version import VERSION_TAG
|
||||
from searx.sxng_locales import sxng_locales
|
||||
from searx.exceptions import SearxXPathSyntaxException, SearxEngineXPathException
|
||||
@@ -92,6 +92,14 @@ def gen_useragent(os_string: str | None = None) -> str:
|
||||
)
|
||||
|
||||
|
||||
def gen_gsa_useragent() -> str:
|
||||
"""Return a random GSA User Agent suitable for Google
|
||||
|
||||
See searx/data/gsa_useragents.txt
|
||||
"""
|
||||
return choice(gsa_useragents_loader())
|
||||
|
||||
|
||||
class HTMLTextExtractor(HTMLParser):
|
||||
"""Internal class to extract text from HTML"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user