Package for scraping information from different blogging websites.
For the latest version:
npm i article_scraper
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: []
}