Basic Web Search is a short Python example. It runs one web query, sets a start offset, and prints the results. Each result can include a title, snippet, link, date, source and highlights.
The problem
A web result page is enough to read. A script needs the same rows as data: title, link, snippet and source, plus a way to ask for the next page.
What the example does
- Sends a query and a start offset.
- Prints the result list.
How it works
The file calls basic_web_search with query, num and start. The current SDK method is web_search. It calls GET /web with query and start. Use those two arguments. start is how many results to skip.
The rank checker example uses the same endpoint when you want the best rank of one domain across many keywords.
The code
result = desearch.basic_web_search(query="latest news on AI", num=10, start=0)
Set the key in the environment when you use the current client. The file's setup lines use a placeholder string. Do not commit a real key.
Endpoints
GET /web
Example output
The file documents result fields: title, snippet, link, date, source, author, image, favicon and highlights. It does not include a saved sample run or a measured cost.
Run it yourself
The file linked above is basic_web_search.py in the examples repository. Install desearch-py, create a key at console.desearch.ai, and call web_search with query and start.
What it costs
This example does not record X-Desearch-Cost-Usd. Current responses include that header. See pricing.
Ideas to extend it
- Page with
startuntil you have the number of new URLs you need. - Pass the links to the page-to-Markdown example.
- Check one domain's best rank with the rank checker.
