Fully typed TypeScript SDK for the 4get search engine API. Zero runtime dependencies — uses native fetch.
npm install 4get-sdkRequires Node 18+ (or any runtime with fetch).
import { FgetClient } from "4get-sdk";
const client = new FgetClient("https://4get.ca");
const results = await client.web({ s: "higurashi", extendedsearch: true });
for (const hit of results.web) {
console.log(hit.title, hit.url);
}
// Next page — npt alone suffices, do not resend `s`
const page2 = await client.web({ npt: results.npt! });
const pics = await client.images({ s: "higurashi", nsfw: "no" });
const clips = await client.videos({ s: "higurashi", sort: "upload_date" });
const headlines = await client.news({ s: "higurashi" });
const tunes = await client.music({ s: "higurashi", type: "track" });
const suggestions = await client.autocomplete("higurashi");
const meta = await client.ami4get(); // instance info, version, instance listInstances with bot protection require a pass cookie (from solving the captcha):
const client = new FgetClient("https://4get.ca", "your-token");client.favicon("https://lolcat.ca"); // /favicon?s=...
client.proxy("https://example.com/pic.png", "square"); // /proxy?i=...&s=square
client.audioUrl("sc", "https://api-v2.soundcloud.com/..."); // /audio/sc?s=...For audio proxying, honor SongResult.stream.endpoint: "linear" (or null) means a plain HTTP stream; anything else must be proxied via audioUrl.
All search responses are typed (WebResponse, ImagesResponse, VideosResponse, NewsResponse, MusicResponse). Every response carries status (throws FgetError unless "ok") and npt (pagination token, null when no more pages). Most fields can be null — the types reflect that.
npm test # runs against $FGET_INSTANCE (default http://localhost:8888)Respect the 4get API terms — cache responses, don't scrape intensively, and don't use it for SERP SEO.