1.1.0 • Published 6 years ago

mini-scrape v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

mini-scrape

npm version

simple scrape function working only nodejs

Installation

$ npm install mini-scrape

or yarn

$ yarn install mini-scrape

Example

const scrape = require('mini-scrape')
const url = 'https://github.com/mottox2/mini-scrape'

scrape(url).then(window => {
  console.log('title: ', window.document.title)
  console.log('h1: ', window.document.querySelector('h1').textContent.replace(/\n/g, ''))
})

webpack

import scrape from 'mini-scrape'
const url = 'https://github.com/mottox2/mini-scrape'

scrape(url).then(window => {
  console.log('title: ', window.document.title)
  console.log('h1: ', window.document.querySelector('h1').textContent.replace(/\n/g, ''))
})

with headers

import scrape from 'mini-scrape'
const url = 'https://github.com/mottox2/mini-scrape'

scrape(url, {
  headers: {
    'User-Agent': 'mini-scrape'
  }
}).then(window => {
  console.log('title: ', window.document.title)
  console.log('h1: ', window.document.querySelector('h1').textContent.replace(/\n/g, ''))
})
1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago