Giter VIP home page Giter VIP logo

scrapman's Introduction

Scrapman

Ski-bi dibby dib yo da dub dub
Yo da dub dub
Ski-bi dibby dib yo da dub dub
Yo da dub dub

I'm the Scrapman!

THE FASTEST SCRAPPER EVER*... AND IT SUPPORTS PARALLEL REQUESTS (*arguably)

Scrapman is a blazingly fast real (with Javascript executed) HTML scrapper, built from the ground up to support parallel fetches, with this you can get the HTML code for 50+ URLs in seconds (~30 seconds).

On NodeJS you can easily use request to fetch the HTML from a page, but what if the page you are trying to load is NOT a static HTML page, but it has dynamic content added with Javascript? What do you do then? Well, you use The Scrapman.

It uses Electron to dynamically load web pages into several <webview> within a single Chromium instance. This is why it fetches the HTML exactly as you would see it if you inspect the page with DevTools.

This is NOT an browser automation tool (yet), it's a node module that gives you the processed HTML from an URL, it focuses on multiple parallel operations and speed.

USAGE

1.- Install it

npm install scrapman -S

2.- Require it

var scrapman = require("scrapman");

3.- Use it (as many times as you need)

Single URL request

scrapman.load("http://google.com", function(results){
	//results contains the HTML obtained from the url
	console.log(results);
});

Parallel URL requests

//yes, you can use it within a loop.
for(var i=1; i<=50; i++){
    scrapman.load("https://www.website.com/page/" + i, function(results){
        console.log(results);
    });
}

API

- scrapman.load(url, callback)

url

Type: String

The URL from which the HTML code is going to be obtained.

callback(results)

Type: Function

The callback function to be executed when the loading is done. The loaded HTML will be in the results parameter.

- scrapman.configure(config)

config

The configuration object can set the following values

  • maxConcurrentOperations: Integer - The intensity of processing, how many URLs can be loaded at the same time, default: 50

  • wait: Integer - The amount of milliseconds to wait before returning the HTML code of a webpage after it has been completely loaded, default: 0

Questions

Feel free to open Issues to ask questions about using this package, PRs are very welcomed and encouraged.

SE HABLA ESPAÑOL

License

MIT © Daniel Nieto

scrapman's People

Contributors

danielnieto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

scrapman's Issues

Is it possible to set cookies

Hi ,
I am looking for something similar. Just wanted to know if its possible to set and use cookies in the Electron app across webviews, through the module yet?

Thanks

Issues using Scrapman with Linux

Hi Daniel, I am having trouble getting Scrapman to work in Ubuntu (16.04), just hangs and doesn't provide any callback when calling scrapman.load. I noticed on a prior post you mentioned that you had not tested it on Linux (although that was back in 2017). I have checked that I have a linux electron install so that is not the issue. Thoughts welcome and thanks.

Scrapman does not exit after request

Scrapman appears to hang after making requests on Ubuntu 16.04. Checking the processes (ps aux | grep electron), electron still remains running (see picture below). Sending a SIGTERM to electron processes exits the scrapman script (killall electron). Please let me know if you need anymore info.

Scrapman.js.txt

selection_002

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.