Skip to content

Commit 414133c

Browse files
committed
Improve description of onRespones
1 parent c20cad0 commit 414133c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ await getLinkPreview(`http://google.com/`, {
160160
});
161161
```
162162

163-
## onResponse Use Cases
164-
There may be situations where you need to provide your own logic for population properties in the response object. For example, if the library is unable to detect a description because the website does not provide OpenGraph data, you might want to use the text value of the first paragraph instead. This callback gives you access to the Cheerio doc instance, as well as the URL object so you could handle cases on a site-by-site basis, if you need to. This callback must return the modified response object
163+
## onResponse
164+
165+
In some cases the website might be missing OpenGraph tags and you might want to provide your own custom logic to try to parse data. For example, if the library is unable to detect a description, you might want to use the text value of the first paragraph instead. This callback gives you access to the Cheerio (the library internally used to parse the HTML) instance, as well as the URL object so you could handle cases on a site-by-site basis, if you need to. This callback must return the modified response object
165166

166167
```javascript
167168
await getLinkPreview(`https://example.com/`, {

0 commit comments

Comments
 (0)