Giter VIP home page Giter VIP logo

nodesavepagewe's Introduction

nodeSavePageWE

This is an updated fork of the SavePageWE Chrome/Firefox extension by DW-dev. The 2019 version was based of then current version of the SavePageWE chrome extension and this version uses the March 2023 version. The old version still works but doesn't give good results on many websites anymore. The newer version should fix many of these errors.

It allows you to convert a website into a single, self-contained HTML that embeds most of the required resources. It uses puppeteer as a headless Chrome browser on the backend.

Usage is very simple: this example converts the New York Times home page to a single HTML file.

var savePageWE=require('./nodeSavePageWE');


savePageWE.scrape({ url: "https://www.nytimes.com", path: "nytimes.html" }).then(function ()
{
    console.log("ok");
});

I found that SavePageWE is the best and fastest single-page HTML condenser. Unfortunately, headless Chrome does not allow Chrome extensions. The original codebase consists essentially of two scripts: (1) a background script that runs outside the website and interacts with the Save button, loads images and other resources etc.; and (2) a client script that traverses all frames and collects a list of images, scripts, fonts etc.

In this fork, I wrote a new background script for Node.js but kept most of the code from the client script (the NodeSavePage_client.js source file combines the content.js and content-frame.js file from the extension. Since I couldn't find the original project by DW-dev on GitHub I am also including the original Chrome extension code.

I am mostly using this code for scraping news websites and on a test sample this Node.js version seems to work about as well as the original extension (with some oddities such as sometimes not loading all images). Please contribute and make it better!

nodesavepagewe's People

Contributors

markusmobius avatar msr311 avatar

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.