SearXNG Search
This skill enables web search using a custom SearXNG instance via its HTTP API.
Overview
SearXNG is a privacy-respecting metasearch engine that aggregates results from multiple search engines. This skill allows you to search using a custom SearXNG instance URL.
API Endpoints
GET / or GET /search - Query parameters in URL
POST / or POST /search - Form data
Required Configuration
You need a SearXNG instance URL. The user can provide:
- A public instance URL (e.g.,
https://searx.be)
- A self-hosted instance URL
- An environment variable
SEARXNG_URL containing the instance URL
Parameters
| Parameter |
Required |
Description |
q |
Yes |
Search query string |
format |
No |
Output format: json, csv, rss (default: HTML) |
language |
No |
Language code (e.g., en, zh, de) |
pageno |
No |
Page number (default: 1) |
time_range |
No |
Time filter: day, month, year |
categories |
No |
Comma-separated category list |
engines |
No |
Comma-separated engine list |
safesearch |
No |
Safe search level: 0, 1, 2 |
Categories and Engines
SearXNG organizes search into categories (tabs) with multiple engines per category.
Available Categories:
general - General web search
images - Image search
videos - Video search
news - News articles
map - Maps and locations
music - Music and audio
it - IT/Technology resources
science - Scientific publications
files - Files and torrents
social_media - Social media content
Common Engines:
- Web:
google, duckduckgo, bing, brave, startpage, wikipedia
- Images:
google images, bing images, unsplash, flickr
- Videos:
youtube, google videos, vimeo, dailymotion
- News:
google news, bing news, reuters
- IT:
github, stackoverflow, arch linux wiki, pypi
- Science:
google scholar, arxiv, pubmed
Bang Syntax: Use ! prefix in queries to target specific engines:
!go python - Search Google
!wp artificial intelligence - Search Wikipedia
!github machine learning - Search GitHub
For detailed engine lists and features, see references/engines_and_categories.md.
Usage
Using the Python Script
# Basic search
python scripts/searxng_search.py -u https://searx.example.org -q "python tutorial"
# JSON output
python scripts/searxng_search.py -u https://searx.example.org -q "python tutorial" --format json
# With language and time range
python scripts/searxng_search.py -u https://searx.example.org -q "news" --lang en --time-range day
# Use environment variable for URL
export SEARXNG_URL=https://searx.example.org
python scripts/searxng_search.py -q "search query"
# Search specific category
python scripts/searxng_search.py -u https://searx.example.org -q "AI" --categories news
# Search specific engines
python scripts/searxng_search.py -u https://searx.example.org -q "python" --engines google,stackoverflow
Using HTTP Requests Directly
import requests
url = "https://searx.example.org/search"
params = {
"q": "python tutorial",
"format": "json",
"language": "en",
"categories": "general,it", # Multiple categories
"engines": "google,duckduckgo" # Specific engines
}
response = requests.get(url, params=params, timeout=30)
results = response.json()
Bang Syntax in Query
# Use bang syntax to target specific engines
params = {
"q": "!github machine learning framework", # Only search GitHub
"format": "json"
}
JSON Response Format
{
"query": "search query",
"number_of_results": 1000000,
"results": [
{
"title": "Result Title",
"url": "https://example.com",
"content": "Snippet text...",
"engine": "google",
"score": 1.0
}
],
"answers": [],
"suggestions": [],
"unresponsive_engines": []
}
Important Notes
- Format Availability: JSON/CSV/RSS formats must be enabled in the instance's
settings.yml. Many public instances disable these formats.
- Rate Limiting: Be respectful of the instance's resources. Add delays between requests.
- Self-Hosting: For reliable API access, consider self-hosting a SearXNG instance.
- Time Range: Not all engines support time range filtering. Check instance preferences.
- Engine Availability: Not all engines are enabled on all instances. Check the instance's preferences page.
Example Workflows
Basic Web Search
- Ask user for SearXNG instance URL or use configured URL
- Construct search query
- Call API with
format=json
- Parse and present results
Category-Specific Search
- Choose category based on query type (news, images, science, etc.)
- Use
categories parameter or bang syntax
- Filter results as needed
Multi-Page Search
- Perform initial search
- If more results needed, increment
pageno parameter
- Combine results from multiple pages
Filtered Search
- Use
time_range=day for recent results
- Use
safesearch=2 for strict filtering
- Use
language parameter for locale-specific results
- Use
categories or engines to narrow search scope
References
- engines_and_categories.md - Complete list of engines and categories
1---2name: web-search-by-searxng3description: Search using a custom SearXNG instance via HTTP API. Enables privacy-friendly web search by aggregating results from multiple search engines. Supports query, format (json/csv/rss), language, time range, categories, engines, pagination, and safe search filtering. Requires a user-provided or configured SearXNG instance URL.4---5
6# SearXNG Search
7
8This skill enables web search using a custom SearXNG instance via its HTTP API.
9
10## Overview
11
12SearXNG is a privacy-respecting metasearch engine that aggregates results from multiple search engines. This skill allows you to search using a custom SearXNG instance URL.
13
14## API Endpoints
15
16- `GET /` or `GET /search` - Query parameters in URL
17- `POST /` or `POST /search` - Form data
18
19## Required Configuration
20
21You need a SearXNG instance URL. The user can provide:
221. A public instance URL (e.g., `https://searx.be`)
232. A self-hosted instance URL
243. An environment variable `SEARXNG_URL` containing the instance URL
25
26## Parameters
27
28| Parameter | Required | Description |
29|-----------|----------|-------------|
30| `q` | Yes | Search query string |
31| `format` | No | Output format: `json`, `csv`, `rss` (default: HTML) |
32| `language` | No | Language code (e.g., `en`, `zh`, `de`) |
33| `pageno` | No | Page number (default: 1) |
34| `time_range` | No | Time filter: `day`, `month`, `year` |
35| `categories` | No | Comma-separated category list |
36| `engines` | No | Comma-separated engine list |
37| `safesearch` | No | Safe search level: `0`, `1`, `2` |
38
39## Categories and Engines
40
41SearXNG organizes search into categories (tabs) with multiple engines per category.
42
43**Available Categories:**
44- `general` - General web search
45- `images` - Image search
46- `videos` - Video search
47- `news` - News articles
48- `map` - Maps and locations
49- `music` - Music and audio
50- `it` - IT/Technology resources
51- `science` - Scientific publications
52- `files` - Files and torrents
53- `social_media` - Social media content
54
55**Common Engines:**
56- Web: `google`, `duckduckgo`, `bing`, `brave`, `startpage`, `wikipedia`
57- Images: `google images`, `bing images`, `unsplash`, `flickr`
58- Videos: `youtube`, `google videos`, `vimeo`, `dailymotion`
59- News: `google news`, `bing news`, `reuters`
60- IT: `github`, `stackoverflow`, `arch linux wiki`, `pypi`
61- Science: `google scholar`, `arxiv`, `pubmed`
62
63**Bang Syntax:** Use `!` prefix in queries to target specific engines:
64- `!go python` - Search Google
65- `!wp artificial intelligence` - Search Wikipedia
66- `!github machine learning` - Search GitHub
67
68For detailed engine lists and features, see [references/engines_and_categories.md](references/engines_and_categories.md).
69
70## Usage
71
72### Using the Python Script
73
74```python
75# Basic search
76python scripts/searxng_search.py -u https://searx.example.org -q "python tutorial"
77
78# JSON output
79python scripts/searxng_search.py -u https://searx.example.org -q "python tutorial" --format json
80
81# With language and time range
82python scripts/searxng_search.py -u https://searx.example.org -q "news" --lang en --time-range day
83
84# Use environment variable for URL
85export SEARXNG_URL=https://searx.example.org
86python scripts/searxng_search.py -q "search query"
87
88# Search specific category
89python scripts/searxng_search.py -u https://searx.example.org -q "AI" --categories news
90
91# Search specific engines
92python scripts/searxng_search.py -u https://searx.example.org -q "python" --engines google,stackoverflow
93```
94
95### Using HTTP Requests Directly
96
97```python
98import requests
99
100url = "https://searx.example.org/search"
101params = {
102 "q": "python tutorial",
103 "format": "json",
104 "language": "en",
105 "categories": "general,it", # Multiple categories
106 "engines": "google,duckduckgo" # Specific engines
107}
108
109response = requests.get(url, params=params, timeout=30)
110results = response.json()
111```
112
113### Bang Syntax in Query
114
115```python
116# Use bang syntax to target specific engines
117params = {
118 "q": "!github machine learning framework", # Only search GitHub
119 "format": "json"
120}
121```
122
123## JSON Response Format
124
125```json
126{
127 "query": "search query",
128 "number_of_results": 1000000,
129 "results": [
130 {
131 "title": "Result Title",
132 "url": "https://example.com",
133 "content": "Snippet text...",
134 "engine": "google",
135 "score": 1.0
136 }
137 ],
138 "answers": [],
139 "suggestions": [],
140 "unresponsive_engines": []
141}
142```
143
144## Important Notes
145
1461. **Format Availability**: JSON/CSV/RSS formats must be enabled in the instance's `settings.yml`. Many public instances disable these formats.
1472. **Rate Limiting**: Be respectful of the instance's resources. Add delays between requests.
1483. **Self-Hosting**: For reliable API access, consider self-hosting a SearXNG instance.
1494. **Time Range**: Not all engines support time range filtering. Check instance preferences.
1505. **Engine Availability**: Not all engines are enabled on all instances. Check the instance's preferences page.
151
152## Example Workflows
153
154### Basic Web Search
1551. Ask user for SearXNG instance URL or use configured URL
1562. Construct search query
1573. Call API with `format=json`
1584. Parse and present results
159
160### Category-Specific Search
1611. Choose category based on query type (news, images, science, etc.)
1622. Use `categories` parameter or bang syntax
1633. Filter results as needed
164
165### Multi-Page Search
1661. Perform initial search
1672. If more results needed, increment `pageno` parameter
1683. Combine results from multiple pages
169
170### Filtered Search
1711. Use `time_range=day` for recent results
1722. Use `safesearch=2` for strict filtering
1733. Use `language` parameter for locale-specific results
1744. Use `categories` or `engines` to narrow search scope
175
176## References
177
178- [engines_and_categories.md](references/engines_and_categories.md) - Complete list of engines and categories