Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xdk78/grabbi
grabbi a simple web scraper/crawler
https://github.com/xdk78/grabbi
crawler html scraper web-scraper
Last synced: 14 days ago
JSON representation
grabbi a simple web scraper/crawler
- Host: GitHub
- URL: https://github.com/xdk78/grabbi
- Owner: xdk78
- License: mit
- Created: 2018-05-10T17:17:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-23T16:35:54.000Z (over 5 years ago)
- Last Synced: 2023-08-24T02:36:42.293Z (about 1 year ago)
- Topics: crawler, html, scraper, web-scraper
- Language: JavaScript
- Homepage:
- Size: 106 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# grabbi [![Build Status](https://travis-ci.org/xdk78/grabbi.svg?branch=master)](https://travis-ci.org/xdk78/grabbi)
simple web scraper/crawlergrabbi using JSDOM and axios under hood provide simple but powerful way for scraping websites.
## Install grabbi
npm i grabbi
## Usage
```js
const grabbi = require('grabbi')grabbi('https://www.github.com').then(({ doc, res }) => {
console.log(doc.title)
console.log(doc.getElementsByClassName('alt-lead mb-4')[0].textContent)
}).catch(err => console.log(err))
```## Custom config
```js
const grabbi = require('grabbi')// you can use https://github.com/axios/axios#axios-api as config
const config = {
method: 'get',
timeout: 10000,
headers: { 'X-Custom-Header': 'foobar' }
}grabbi('https://en.wikipedia.org/wiki/Main_Page', config).then(({ doc, res }) => {
console.log(doc.title)
console.log(doc.querySelector('div[id="articlecount"]').textContent)
}).catch(err => console.log(err))
```