summaryrefslogtreecommitdiff
path: root/searx/engines/bing.py
AgeCommit message (Collapse)Author
2025-11-06[enh] py: drop deps (#5407)Ivan Gabaldon
The difference between decompression with brotli or gzip in HTML files is negligible for 3 MB of compiled binary package. Introduced in https://github.com/searxng/searxng/commit/eaa694fb7d0e47b943bc6d6edb6cb6a40ab2d85e Closes https://github.com/searxng/searxng/security/code-scanning/276 Closes https://github.com/searxng/searxng/security/dependabot/37
2025-10-17[mod] bing engine: follow redirects (#5324)Bnyro
Apparently, in China, Bing redirects from `www.bing.com` to `cn.bing.com`. So in order to make Bing work for chinese users by default, we have to follow that redirect. related: https://github.com/searxng/searxng/issues/5243
2025-09-03[mod] addition of various type hints / tbcMarkus Heiser
- pyright configuration [1]_ - stub files: types-lxml [2]_ - addition of various type hints - enable use of new type system features on older Python versions [3]_ - ``.tool-versions`` - set python to lowest version we support (3.10.18) [4]_: Older versions typically lack some typing features found in newer Python versions. Therefore, for local type checking (before commit), it is necessary to use the older Python interpreter. .. [1] https://docs.basedpyright.com/v1.20.0/configuration/config-files/ .. [2] https://pypi.org/project/types-lxml/ .. [3] https://typing-extensions.readthedocs.io/en/latest/# .. [4] https://mise.jdx.dev/configuration.html#tool-versions Signed-off-by: Markus Heiser <markus.heiser@darmarit.de> Format: reST
2025-06-08[feat] bing: raise error upon receiving wrong results page0xhtml
2025-03-01[fix] bing fetch engine traits - adjusted XPath selectorsMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-12-29[fix] update_engine_traits.py: annas archive, bing-* and zlibrary enginesMarkus Heiser
Github action Update data - update_engine_traits [1] had issues in annas archive, bing-* and zlibrary engines: ./manage pyenv.cmd python ./searxng_extra/update/update_engine_traits.py [1] https://github.com/searxng/searxng/actions/runs/12530827768/job/34953392587 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-11-24[chore] *: fix typos detected by typos-cliBnyro
2024-03-11[mod] pylint all engines without PYLINT_SEARXNG_DISABLE_OPTIONMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-12-03[mod] add option max_page to bing, brave, qwant, startpage & mojeekMarkus Heiser
[1] https://github.com/searxng/searxng/issues/2982#issuecomment-1808975780 Reported-by: @Damaj301damaj-lol [1] Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-10-01[fix] Revision of the Bing enginesMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-10-01[fix] engine - bing fix search, pagination, remove safesearchjazzzooo
2023-08-29[mod] bing: resolve redirect without additional requestsAlexandre Flament
Remove the usage of searx.network.multi_requests The results from Bing contains the target URL encoded in base64 See the u parameter, remove the first two character "a1", and done. Also add a comment the check of the result_len / pageno ( from https://github.com/searx/searx/pull/1387 )
2023-06-25[fix] engine & network issues / documentation and type annotationsMarkus Heiser
This patch fixes some quirks and issues related to the engines and the network. Each engine has its own network and this network was broken for the following engines[1]: - archlinux - bing - dailymotion - duckduckgo - google - peertube - startpage - wikipedia Since the files have been touched anyway, the type annotaions of the engine modules has also been completed so that error messages from the type checker are no longer reported. Related and (partial) fixed issue: - [1] https://github.com/searxng/searxng/issues/762#issuecomment-1605323861 - [2] https://github.com/searxng/searxng/issues/2513 - [3] https://github.com/searxng/searxng/issues/2515 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-08[fix] Bing-WEB: use <span class='algoSlug_icon'> for the descriptionMarkus Heiser
On some result items from Bing-WEB the `<span class='algoSlug_icon'>` tag is the only tag that contains a description. The issue can be reproduced by [1]:: !bi vmware [1] https://github.com/searxng/searxng/issues/1764#issuecomment-1417990531 Reported-by: @AlyoshaVasilieva Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[doc] add a description of bing engines (web, news, video, images)Markus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] bing: add time_range support & upgrade to data_type: traits_v1Markus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] bing: fetch engine traits (data_type: supported_languages)Markus Heiser
Implements a fetch_traits function for the Bing engines. .. note:: Does not include migration of the request methode from 'supported_languages' to 'traits' (EngineTraits) object! Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-01-09[fix] bing: parsing result; check to see if the element contains linksAhmad Alkadri
This patch is to hardening the parsing of the bing response: 1. To fix [2087] check if the selected result item contains a link, otherwise skip result item and continue in the result loop. Increment the result pointer when a result has been added / the enumerate that counts for skipped items is no longer valid when result items are skipped. To test the bugfix use: ``!bi :all cerbot`` 2. Limit the XPath selection of result items to direct children nodes (list items ``li``) of the ordered list (``ol``). To test the selector use: ``!bi :en pontiac aztek wiki`` .. in the result list you should find the wikipedia entry on top, compare [2068] [2087] https://github.com/searxng/searxng/issues/2087 [2068] https://github.com/searxng/searxng/issues/2068
2023-01-08[fix] Bing-Web engine: XPath to get the wikipedia resultahmad-alkadri
Modify the XPath selector to get the wikipedia result plus small fixes. About result content: especially with the Wikipedia result, we'd get several paragraph elements, only the first paragraph would be taken and displayed on the search result
2022-08-01[mod] add 'Accept-Language' HTTP header to online processoresMarkus Heiser
Most engines that support languages (and regions) use the Accept-Language from the WEB browser to build a response that fits to the language (and region). - add new engine option: send_accept_language_header Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-07-08bing.py: resolve bing.com/ck/a redirectionsAlexandre Flament
add a new function searx.network.multi_requests to send multiple HTTP requests at once
2022-03-31bing engine: _fetch_supported_languages: don't use the language code as a ↵Alexandre FLAMENT
country ref #1029
2022-01-05[enh] add more categoriesMartin Fischer
2022-01-01[fix] bing engines: fetch_supported_languagesMarkus Heiser
The Request to and the Response from https://www.bing.com/account/general has been changed. [1] https://github.com/searxng/searxng/pull/672#discussion_r777104919 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-12-27[format.python] initial formatting of the python codeMarkus Heiser
This patch was generated by black [1]:: make format.python [1] https://github.com/psf/black Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-12-18[fix] bing engine: fix paging support, show inital page.Markus Heiser
Follow up queries for the pages needed to be fixed. - Split search-term in one for initial query and one for following queries. - Set some headers in HTTP requests, bing needs for paging support. - IMO //div[@class="sa_cc"] does no longer match in a bing response. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-12-18[pylint] Bing (Web) engineMarkus Heiser
Fix remarks from pylint and improved code-style. In preparation for a bug-fix of the Bing (Web) engine I add this engine to the pylint-list. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-06[mod] one logger per engine - drop obsolete logger.getChildMarkus Heiser
Remove the no longer needed `logger = logger.getChild(...)` from engines. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-02-01[mod] dynamically set language_support variableAlexandre Flament
The language_support variable is set to True by default, and set to False in only 5 engines. Except the documentation and the /config URL, this variable is not used. This commit remove the variable definition in the engines, and set value according to supported_languages length: False when the length is 0, True otherwise. Close #2485
2021-01-14[enh] engines: add about variableAlexandre Flament
move meta information from comment to the about variable so the preferences, the documentation can show these information
2020-11-14[mod] remove unused importAlexandre Flament
use from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA so it is possible to easily remove all unused import using autoflake: autoflake --in-place --recursive --remove-all-unused-imports searx tests
2020-10-02[mod] move extract_text, extract_url to searx.utilsAlexandre Flament
2020-09-10Drop Python 2 (4/n): SearchQuery.query is a str instead of bytesDalf
2020-09-10Drop Python 2 (1/n): remove unicode string and url_utilsDalf
2020-03-01bing_news: parital rollback of c89c05bcMarkus Heiser
The bing_news bug (discussed in #1838) was caused by wrong language tags, which was fixed e0c99d9d / no need to change the bing_news search string. closes: https://github.com/asciimoo/searx/issues/1838 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-03-01bugfix: fetch_supported_languages bing, -news, -videos, -imagesMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-01-02[fix] pep8Adam Tauber
2020-01-02[fix] handle missing result sizeAdam Tauber
2019-11-15[mod] speed optimizationDalf
compile XPath only once avoid redundant call to urlparse get_locale(webapp.py): avoid useless call to request.accept_languages.best_match
2019-08-05Fix bing engine results count (#1387)Léo Bourrel
This PR fixes the result count from bing which was throwing an (hidden) error and add a validation to avoid reading more results than avalaible. For example : If there is 100 results from some search and we try to get results from 120 to 130, Bing will send back the results from 0 to 10 and no error. If we compare results count with the first parameter of the request we can avoid this "invalid" results.
2019-08-05[fix] bing engineDalf
before this commit, sometimes there are no results use a generic user-agent instead of one with the OS "Windows NT 6.3; WOW64"
2019-01-07Revert "remove 'all' option from search languages"Noémi Ványi
This reverts commit 4d1770398a6af8902e75c0bd885781584d39e796.
2018-05-20fix bing "garbage" results (issue #1275)Marc Abonce Seguin
2018-03-27refactor engine's search language handlingMarc Abonce Seguin
Add match_language function in utils to match any user given language code with a list of engine's supported languages. Also add language_aliases dict on each engine to translate standard language codes into the custom codes used by the engine.
2017-12-06remove 'all' option from search languagesmarc
2017-05-15[enh] py3 compatibilityAdam Tauber
2017-03-18make search language handling less strictmarc
languages.py can change, so users may query on a language that is not on the list anymore, even if it is still recognized by a few engines. also made no and nb the same because they seem to return the same, though most engines will only support one or the other.
2016-12-30[fix] use english as default language in bingAdam Tauber
If no language is specified, bing returns results with multiple languages for one query which isn't really useful. Setting english as default insted if nothing.
2016-12-15tests for _fetch_supported_languages in enginesmarc
and refactor method to make it testable without making requests
2016-12-13[mod] fetch supported languages for several enginesmarc
utils/fetch_languages.py gets languages supported by each engine and generates engines_languages.json with each engine's supported language.