Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Web Scraping API in Node.js — Zero-Dependency Examples

Scrape any page from Node.js with native fetch only — no axios, no cheerio, no puppeteer in your package.json. The API does fetching, JS rendering and content extraction server-side; your code stays a plain HTTP call.

URL → markdown

const res = await fetch("https://app.quantumproxies.io/api/v1/scraper/extract", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.QP_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ url: "https://news.ycombinator.com", format: "markdown" }),
});

const { content } = await res.json();
console.log(content);

URL → structured JSON

body: JSON.stringify({
  url: "https://books.toscrape.com",
  render: true,
  extract: { books: [{ title: "string", price: "string" }] },
})
// -> (await res.json()).data.books

Express endpoint in front of it

A common shape — a tiny internal service your team hits with just a URL:

app.get("/preview", async (req, res) => {
  const r = await scrape(req.query.url);      // wrapper from scrape.mjs
  res.json({ url: req.query.url, markdown: r.content.slice(0, 2000) });
});

Full runnable module with error handling and typed JSDoc: scrape.mjs

QP_API_KEY=qp_live_... node scrape.mjs https://example.com

Why not just fetch the page directly?

Direct fetch gives you raw HTML — if the site doesn't block datacenter IPs outright or hide everything behind client-side rendering. The extract endpoint exits through residential IPs, renders when needed, and returns content instead of markup.

API: QuantumProxies Scraper API · playground (try without code): quantumproxies.io/extract-api · keys: app.quantumproxies.io/api-keys.

About

Zero-dependency web scraping in Node.js: native fetch against a scraping API, markdown and structured JSON out.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages