Giter Site home page Giter Site logo

electron-scraper-skeleton's Introduction

Electron Scraper Skeleton

This is a stub that demonstrates how to use Electron to scrape sites that require cookies/javascript/ or intermittently require captchas.

There's a bit to "grok" when using Electron like this so here's the breakdown of what fits where. index.js is loaded inside your main Electron app process which loads index.html into the "main" BrowserWindow, and note they don't share any scope. Next, index.html contains a "webview" which will load the site you're interested in scraping. And finally, injected.js is autoloaded into the same scope as the webview, so it can access the DOM, and it can also load nodejs modules. But the wrinkle is that injected.js can't communicate with any code in index.html without using Electron's IPC services.

What's in here?

There's a couple of files that are mostly just stubs.

index.js - The main Electron entry point, this really just loads index.html in the "main" Electron window. index.html - Aforementioned page which loads your target site in a webview. injected.js - This is the JavaScript file that's injected into the webview, alongside the target site.

How do I run this?

You should be able to just run:

npm install
./node_modules/electron/dist/electron .

To launch

Oh but is there more?

Just one more! As of 3/17/17 it's possible to use the Tor client as a SOCKS proxy which Electron can be configured to use. So if you download and launch Tor you can launch Electron with the following to pipe your traffic through Tor:

./node_modules/electron/dist/electron --proxy-server="socks5://localhost:9150" .

And then to get a fresh IP address via a new Tor circuit you can run 'killall -HUP tor'

electron-scraper-skeleton's People

Contributors

adatta02 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

heruputra

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.