How to use open-graph-scraper - 1 common examples

To help you get started, we’ve selected a few open-graph-scraper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hugodias / facebook-post-preview / src / lambda / open-graph-preview.js View on Github external
if (!urls.size) {
    return callback(null, {
      statusCode: 200,
      body: JSON.stringify({
        text: text,
        meta: null,
        error: ["Empty url in text"]
      })
    });
  }

  // Retrieve first URL in text - urls are already normalized
  const url = [...urls][0];
  const options = { url };

  ogs(options, (error, results) => {
    const statusCode = results.success ? 200 : 500;
    callback(null, buildResponseObject(statusCode, results, text));
  });
}

open-graph-scraper

Node.js scraper module for Open Graph and Twitter Card info

MIT
Latest version published 2 months ago

Package Health Score

80 / 100
Full package analysis

Popular open-graph-scraper functions