Skip to content

victrme/search-suggestions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Search Suggestions API

An API that parses search suggestions from a number of search providers. Might not live very long depending on the volatility of their APIs. Here's the list of available search providers:

  • Google ( w/ presentations )
  • Yahoo ( w/ presentations )
  • Brave ( w/ presentations )
  • Bing ( w/ presentations )
  • Duckduckgo
  • Qwant

Try it here: https://suggestions.victr.me/

How to use

Endpoint

GET /
Parameter Role Requirement
q Search query required
l Localization optional
with Search provider optional

Response

type Response = {
  text: string
  desc?: string // when presentation is available
  image?: string // when presentation is available
}[]

Websockets

Using Clouflare workers, you can also get results using websockets.

const socket = new WebSocket('ws://localhost:8787')

socket.onmessage = function (event: MessageEvent) {
  console.log(JSON.parse(event.data))
}

socket.send(JSON.stringify({ q, with, lang }))

Examples

GET /?q=can%20we%20go%20to
[
  { "text": "can we go to heaven with tattoos" },
  { "text": "can we go to mars" },
  { "text": "can we go to saturn" },
  { "text": "can we go to your room now" }
]

GET /?with=google&q=vercel&l=fr
[
  {
    "text": "vercel"
  },
  {
    "text": "vercelli",
    "desc": "Verceil — Ville en Italie",
    "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQID9TX_tSffwg1RLvecGtuPHMZWbbEOSx0d6_poXT6bqChYkEazWYz6G1ilQ&s=10"
  },
  {
    "text": "vercel villedieu le camp",
    "desc": "Commune en France",
    "image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQGB1DiSdJxQgJfHphVKCfENgDCeGWobdbBpErowNFfDEExoFTuRmmPfEVJuQ&s=10"
  },
  {
    "text": "vercel pricing"
  },
  {
    "text": "vercel deploy"
  }
]

Development

  • Install Deno
  • Install NodeJS
  • Make sure npx is installed with npx -v
npx -v
# 10.9.2

deno install
# ...

deno task test
# Task test deno test --allow-net
# ok | 11 passed | 0 failed (2s)

deno task dev
# Task dev npx wrangler dev
# Need to install the following packages
# ...
# [wrangler:info] Ready on http://localhost:8787

wrangler deploy

About

An API that parses search suggestions from a number of search providers (google, bing, duckduckgo...)

Topics

Resources

License

Stars

Watchers

Forks

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy