Skip to content

Latest commit

 

History

History
76 lines (60 loc) · 1.99 KB

README.md

File metadata and controls

76 lines (60 loc) · 1.99 KB

Article Scraper

CI npm Codecov

Package for scraping information from different blogging websites.

✅ Currently supported sites

🚧 Planned sites to support:

Installing

For the latest version:

npm i article_scraper

Usage

import { ArticleMetaData, ArticleScraper } from "article_scraper";

const url = "https://dev.to/ashish9342/commenting-code-good-practices-3d23";
const scraper: ArticleScraper = new ArticleScraper(url);
await scraper.scrape();
const result: ArticleMetaData = scraper.articleMetaData();

The ArticleMetaData result will contain information about the article in the following format. Any errors encountered during scraping will be added to the errors attribute.

ArticleMetaData {
  title: 'Commenting Code | Good Practices',
  minuteRead: 3,
  tags: [
    {
      name: '#programming',
      href: 'https://dev.to/t/programming',
      color: '#ffffff',
      backgroundColor: '#890606'
    },
    {
      name: '#javascript',
      href: 'https://dev.to/t/javascript',
      color: '#000000',
      backgroundColor: '#F7DF1E'
    },
    {
      name: '#codequality',
      href: 'https://dev.to/t/codequality',
      color: '#000000',
      backgroundColor: '#e5fffd'
    },
    {
      name: '#productivity',
      href: 'https://dev.to/t/productivity',
      color: '#C8F7C5',
      backgroundColor: '#2A0798'
    }
  ],
  url: 'https://dev.to/ashish9342/commenting-code-good-practices-3d23',
  errors: []
}