scraping-knife
v0.2.4
Published
Multi-tools for scraping web pages. It helps inject popular JS libraries for scraping to web page.
Downloads
3
Readme
Description
Scraping-knife is an aggregating tool that provides an easy way to add libraries to a web page when you scraping the page.
Install
For npm:
npm install --save scraping-knife
For yarn:
yarn add scraping-knife
Example
For example we can inject scraping-knife to web page by puppeteer
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setBypassCSP(true);
await page.goto(pageUrl);
await page.addScriptTag({
path: require.resolve('scraping-knife')
});
const results = await page.evaluate(async () => {
return SK.$('#some-id').text();
});
await page.close();
await browser.close();