newspk
v2.0.1
Published
A TypeScript-based Node.js library for fetching latest news from Pakistani news sources (Dawn News) in English and Urdu.
Maintainers
Readme
NewsPK - Pakistan News Scraper
A lightweight TypeScript-based Node.js library for fetching the latest news articles from Pakistani news sources (Dawn News). Supports both English and Urdu languages.
Installation
npm install newspkQuick Start
import { news } from 'newspk';
const articles = await news(5, 'english');
console.log(articles);Build & Run
Build the library and run examples:
npm install
npm run build # Compile TypeScript
npm run dev # Watch mode (development)
npm run clean # Remove build outputRun the example (uses ts-node):
npm run exampleAPI Reference
news(limit?: number, lang?: Language): Promise<NewsArticle[]>
Fetches latest news articles from Dawn News.
Parameters:
limit(number, default: 5) - Number of articles to fetch (max: 15)lang(string, default: 'urdu') - Language: 'english' or 'urdu'
Returns: Array of NewsArticle objects
License
MIT - See LICENSE file
Made by Mazan Labeeb
