You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| html | You can pass in an HTML string to run ogs on it. (use without options.url) |||
61
-
| fetchOptions | Options that are used by the Fetch API | {} ||
62
-
| timeout | Request timeout for Fetch (Default is 10 seconds) | 10 ||
63
-
| blacklist | Pass in an array of sites you don't want ogs to run on. |[]||
64
-
| onlyGetOpenGraphInfo | Only fetch open graph info and don't fall back on anything else. Also accepts an array of properties for which no fallback should be used | false ||
65
-
| customMetaTags | Here you can define custom meta tags you want to scrape. |[]||
66
-
| urlValidatorSettings | Sets the options used by validator.js for testing the URL |[Here](https://github.com/jshemas/openGraphScraper/blob/master/lib/utils.ts#L4-L17)||
| html | You can pass in an HTML string to run ogs on it. (use without options.url) |||
61
+
| fetchOptions | Options that are used by the Fetch API | {} ||
62
+
| timeout | Request timeout for Fetch (Default is 10 seconds) | 10 ||
63
+
| blacklist | Pass in an array of sites you don't want ogs to run on. |[]||
64
+
| onlyGetOpenGraphInfo | Only fetch open graph info and don't fall back on anything else. Also accepts an array of properties for which no fallback should be used | false ||
65
+
| customMetaTags | Here you can define custom meta tags you want to scrape. |[]||
66
+
| urlValidatorSettings | Sets the options used by validator.js for testing the URL |[Here](https://github.com/jshemas/openGraphScraper/blob/master/lib/utils.ts#L4-L17)||
67
+
| jsonLDOptions | Sets the options used when parsing JSON-LD data |||
67
68
68
69
Note: `open-graph-scraper` uses the [Fetch API](https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#fetch) for requests and most of [Fetch's options](https://developer.mozilla.org/en-US/docs/Web/API/fetch#options) should work as `open-graph-scraper`'s `fetchOptions` options.
console.log('error:', error); // This returns true or false. True if there was an error. The error itself is inside the result object.
177
+
console.log('html:', html); // This contains the HTML of page
178
+
console.log('result:', result); // This contains all of the Open Graph results
179
+
console.log('response:', response); // This contains response from the Fetch API
180
+
})
181
+
```
182
+
162
183
## Running the example app
163
184
164
185
Inside the `example` folder contains a simple express app where you can run `npm ci && npm run start` to spin up. Once the app is running, open a web browser and go to `http://localhost:3000/scraper?url=http://ogp.me/` to test it out. There is also a `Dockerfile` if you want to run this example app in a docker container.
0 commit comments