DEV Community

allnulled
allnulled

Posted on

Live web scrapping with JS

Despite the popular clam (irony) after my previous post of live debugging with nodelive, I will keep sharing the software I wrote.

First, install web2os.

$ npm i -g web2os

And then, write your first scrap, to... (muaaahahahaha!!) Google search:

require("web2os")
 .create()
 .open("https://www.google.com")
 .onWeb((done, error) => {
   done(document.title);
 })
 .onOs((done, error, data) => {
   require("fs").writeFile(
     "Google title.txt", data, "utf8", ()=> done()
   );
 })
 .run(() => {
   console.log("DONE!");
 });

Then we have to run it. We need electron for that. If you have it installed, proceed (otherwise, install it and proceed):

electron scrap.js

A Chrome browser will open and (muahahahahaha) start to obey your code.

Happy coding.

Top comments (0)