socialcrawl/
← All recipes

Accept any URL your users paste

Let the dispatcher work out the platform — you just hand it a link.

TypeScript
const KEY = process.env.SOCIALCRAWL_API_KEY!;

async function resolve(url: string) {
  const r = await fetch(
    `http://datatrend.nl/v1/lookup?url=${encodeURIComponent(url)}`,
    { headers: { "x-api-key": KEY } }
  );
  const body = await r.json();
  if (!body.success) throw new Error(body.error.message);
  return body;
}

for (const url of [
  "https://github.com/php/php-src",
  "https://www.reddit.com/r/programming",
  "https://news.ycombinator.com/item?id=1",
  "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
]) {
  const { platform, data } = await resolve(url);
  console.log(platform, "→", data.post?.content?.text ?? data.username);
}
You'll need a key. It takes ten seconds and starts with 100 credits. Get a key