🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

mozilla-readability

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mozilla-readability

Mozilla Readability in Rust

0.1.2
Source
npm
Version published
Weekly downloads
118
-7.09%
Maintainers
1
Weekly downloads
 
Created
Source

Mozilla Readability

Mozilla Readability attempts to extract the relevant content of an HTML document returning a parsed and cleaned version.

Example

import * as readability from './pkg/readability_wasm.js'
const instance = new readability.Readability();
const testString = `
    <html>
        <head>
            <link rel="stylesheet">
        </head>
        <body>
            <nav>
                <ul>
                    <li>
                        Home
                    </li>
                    <li>
                        Not Home
                    </li>
                </ul>
            </nav>  
            <div>
                <article>
                    <h1>I am a test</h1>
                    <p>lorem lorem</p>
                    <p>ipsumity ipsum</p>
                </article>
            </div>
        </body>

    </html>

`;

const results = instance.parse();
console.log({
    title: "I am a test",
    byline: null,
    excerpt: "lorem lorem ipsum ipsum",
    site_name: "example.com",
    article_html: `
        <article>
            <h1>I am a test</h1>
            <p>lorem lorem</p>
            <p>ipsumity ipsum</p>
        </article>
    `,
});

Keywords

mozilla

FAQs

Package last updated on 03 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts