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---56# SearXNG Search78This skill enables web search using a custom SearXNG instance via its HTTP API.910## Overview1112SearXNG 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.1314## API Endpoints1516- `GET /` or `GET /search` - Query parameters in URL17- `POST /` or `POST /search` - Form data1819## Required Configuration2021You need a SearXNG instance URL. The user can provide:221. A public instance URL (e.g., `https://searx.be`)232. A self-hosted instance URL243. An environment variable `SEARXNG_URL` containing the instance URL2526## Parameters2728| 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` |3839## Categories and Engines4041SearXNG organizes search into categories (tabs) with multiple engines per category.4243**Available Categories:**44- `general` - General web search45- `images` - Image search46- `videos` - Video search47- `news` - News articles48- `map` - Maps and locations49- `music` - Music and audio50- `it` - IT/Technology resources51- `science` - Scientific publications52- `files` - Files and torrents53- `social_media` - Social media content5455**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`6263**Bang Syntax:** Use `!` prefix in queries to target specific engines:64- `!go python` - Search Google65- `!wp artificial intelligence` - Search Wikipedia66- `!github machine learning` - Search GitHub6768For detailed engine lists and features, see [references/engines_and_categories.md](references/engines_and_categories.md).6970## Usage7172### Using the Python Script7374```python75# Basic search76python scripts/searxng_search.py -u https://searx.example.org -q "python tutorial"7778# JSON output79python scripts/searxng_search.py -u https://searx.example.org -q "python tutorial" --format json8081# With language and time range82python scripts/searxng_search.py -u https://searx.example.org -q "news" --lang en --time-range day8384# Use environment variable for URL85export SEARXNG_URL=https://searx.example.org86python scripts/searxng_search.py -q "search query"8788# Search specific category89python scripts/searxng_search.py -u https://searx.example.org -q "AI" --categories news9091# Search specific engines92python scripts/searxng_search.py -u https://searx.example.org -q "python" --engines google,stackoverflow93```9495### Using HTTP Requests Directly9697```python98import requests99100url = "https://searx.example.org/search"101params = {102 "q": "python tutorial",103 "format": "json",104 "language": "en",105 "categories": "general,it", # Multiple categories106 "engines": "google,duckduckgo" # Specific engines107}108109response = requests.get(url, params=params, timeout=30)110results = response.json()111```112113### Bang Syntax in Query114115```python116# Use bang syntax to target specific engines117params = {118 "q": "!github machine learning framework", # Only search GitHub119 "format": "json"120}121```122123## JSON Response Format124125```json126{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.0136 }137 ],138 "answers": [],139 "suggestions": [],140 "unresponsive_engines": []141}142```143144## Important Notes1451461. **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.151152## Example Workflows153154### Basic Web Search1551. Ask user for SearXNG instance URL or use configured URL1562. Construct search query1573. Call API with `format=json`1584. Parse and present results159160### Category-Specific Search1611. Choose category based on query type (news, images, science, etc.)1622. Use `categories` parameter or bang syntax1633. Filter results as needed164165### Multi-Page Search1661. Perform initial search1672. If more results needed, increment `pageno` parameter1683. Combine results from multiple pages169170### Filtered Search1711. Use `time_range=day` for recent results1722. Use `safesearch=2` for strict filtering1733. Use `language` parameter for locale-specific results1744. Use `categories` or `engines` to narrow search scope175176## References177178- [engines_and_categories.md](references/engines_and_categories.md) - Complete list of engines and categories