Giter Club home page Giter Club logo

Article Metadata Extractor

The Article Metadata Extractor is a JavaScript library that allows you to extract essential metadata from web pages containing articles. It is designed to be used in Node.js 18+.

How It Works

The library uses the Cheerio library to parse and traverse HTML content. It fetches the HTML content of a given URL and extracts the following information from the webpage:

  • Title: The title of the article.
  • Image: The illustrative image associated with the article.
  • Author: The name of the article's author.
  • Tags: A list of keywords or tags associated with the article.
  • Publication Date: The date when the article was published.
  • Read Time: An estimated reading time for the article in minutes.
  • Description: A short excerpt or description of the article.

With NPX

npx article-metadata-extractor <ARTICLE-URL>

Using in Project

  1. Install dependency:
npm install article-metadata-extractor
  1. Import the getArticleMetaData function into your project and use it:
const url = 'https://example.com/article';

getArticleMetaData(url)
  .then(metadata => {
    console.log(metadata);
    // Use the extracted metadata as needed
  })
  .catch(error => {
    console.error('Error:', error.message);
  });

Output

/**
 * Represents the extracted metadata from an article's webpage.
 */
interface ArticleMetadata {
  /**
   * The title of the article.
   */
  title: string;

  /**
   * The URL of the illustrative image associated with the article.
   */
  image: string;

  /**
   * The name of the article's author.
   */
  author: string;

  /**
   * An array of keywords or tags associated with the article.
   */
  tags: string[];

  /**
   * The date when the article was published in ISO 8601 format.
   */
  publicationDate: string | null;

  /**
   * An estimated reading time for the article in minutes based on an average reading speed.
   */
  readTime: number;

  /**
   * A short excerpt or description of the article.
   */
  description: string;
}

Licence

This code is released under the MIT License.

Article Metadata Extractor's Projects

article-metadata-extractor icon article-metadata-extractor

The Article Metadata Extractor is a JavaScript library that allows you to extract essential metadata from web pages containing articles.

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.