Skip to content

Commit

Permalink
doc(): update sample
Browse files Browse the repository at this point in the history
  • Loading branch information
ncarlier committed Nov 5, 2018
1 parent a5ace21 commit 876a1fc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ npm install --save htmlgrabr
The in your code:

```javascript
import HTMLGrabr from 'htmlgrabr'
const HTMLGrabr = require('htmlgrabr')
const { URL } = require('url')

const url = new URL('http://example.com/foo.html')
const page = async HTMLGrabr.grab(url)
const grabber = new HTMLGrabr()

console.log('Page title:', page.title)
console.log('Page illustration:', page.image)
console.log('Page URL:', page.url)
console.log('Page HTML content:', page.html)
console.log('Page text content:', page.text)
console.log('Page images:', page.images)
grabber.grabUrl(new URL('http://keeper.nunux.org'))
.then(page => {
console.log(page)
}, err => {
console.log(err)
})
```

---

0 comments on commit 876a1fc

Please sign in to comment.