3 Commits

Author SHA1 Message Date
Bnyro
44405bd03c [fix] yep: fix 403 forbidden errors
Apparently, yep has been broken for a while. Measures to fix it:
- only use HTTP/1.1, because our HTTP2 client gets fingerprinted and blocked
- send the `Origin` HTTP header
2026-01-10 12:46:22 +01:00
Austin-Olacsi
26e275222b [feat] engines: add CachyOS Packages Search 2026-01-10 12:45:27 +01:00
Elvyria
ae48f50245 [mod] replace #suggestions list wrapper <div> with <ul> (#5575)
This PR removes the "dot" prefix value from the `#suggestions` list's entries and adds it back via CSS instead. It makes styling easier and less hacky for those who are interested, removing the dot with just styles is currently not as easy as I would like it to be.
2026-01-10 10:18:49 +01:00
7 changed files with 84 additions and 14 deletions

View File

@@ -571,13 +571,16 @@ article[data-vim-selected].category-social {
#suggestions {
.wrapper {
display: flex;
flex-flow: column;
justify-content: flex-end;
padding-left: 0;
margin: 0;
list-style-position: inside;
li::marker {
color: var(--color-result-link-font);
}
form {
display: inline-block;
flex: 1 1 50%;
}
}
}
@@ -585,8 +588,8 @@ article[data-vim-selected].category-social {
#suggestions,
#infoboxes {
input {
padding: 0;
margin: 3px;
padding: 3px;
margin: 0;
font-size: 0.9em;
display: inline-block;
background: transparent;

59
searx/engines/cachy_os.py Normal file
View File

@@ -0,0 +1,59 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""CachyOS (packages, it)"""
from urllib.parse import urlencode
from datetime import datetime
from searx.result_types import EngineResults
about = {
"website": 'https://cachyos.org',
"wikidata_id": "Q116777127",
"official_api_documentation": None,
"use_official_api": False,
"require_api_key": False,
"results": "JSON",
}
base_url = "https://packages.cachyos.org/api/search"
categories = ['packages', 'it']
paging = True
results_per_page = 15
def request(query, params):
query_params = {
"search": query,
"page_size": results_per_page,
"current_page": params["pageno"],
}
params["url"] = f"{base_url}?{urlencode(query_params)}"
return params
def response(resp) -> EngineResults:
results = EngineResults()
search_res = resp.json()
for item in search_res["packages"]:
package_name = item["pkg_name"]
arch = item["pkg_arch"]
repo = item["repo_name"]
results.add(
results.types.LegacyResult(
{
"template": 'packages.html',
"url": f"https://packages.cachyos.org/package/{repo}/{arch}/{package_name}",
"title": f"{package_name} ({repo})",
"package_name": package_name,
"publishedDate": datetime.fromtimestamp(item["pkg_builddate"]),
"version": item["pkg_version"],
"content": item["pkg_desc"],
"tags": [arch],
}
)
)
return results

View File

@@ -19,6 +19,8 @@ search_type = "web" # 'web', 'images', 'news'
safesearch = True
safesearch_map = {0: 'off', 1: 'moderate', 2: 'strict'}
enable_http2 = False
def request(query, params):
args = {
@@ -30,6 +32,7 @@ def request(query, params):
}
params['url'] = f"{base_url}/fs/2/search?{urlencode(args)}"
params['headers']['Referer'] = 'https://yep.com/'
params['headers']['Origin'] = 'https://yep.com'
return params

View File

@@ -597,6 +597,11 @@ engines:
# German videos have English subtitles.
disabled: true
- name: cachy os packages
engine: cachy_os
shortcut: cos
disabled: true
- name: chefkoch
engine: chefkoch
shortcut: chef
@@ -686,7 +691,7 @@ engines:
shortcut: yep
categories: general
search_type: web
timeout: 5
timeout: 15
disabled: true
- name: yep images

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,9 @@
<div id="suggestions" role="complementary" aria-labelledby="suggestions-title">
<details class="sidebar-collapsible">
<summary class="title" id="suggestions-title">{{ _('Suggestions') }}</summary>
<div class="wrapper">
<ul class="wrapper">
{%- for suggestion in suggestions -%}
<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
<li><form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
<input type="hidden" name="q" value="{{ suggestion.url }}">
{%- for category in selected_categories -%}
<input type="hidden" name="category_{{ category }}" value="1">
@@ -15,9 +15,9 @@
{%- if timeout_limit -%}
<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >
{%- endif -%}
<input type="submit" class="suggestion" role="link" value="&bull; {{ suggestion.title }}">
</form>
<input type="submit" class="suggestion" role="link" value="{{ suggestion.title }}">
</form></li>
{%- endfor -%}
</div>
</ul>
</details>
</div>