UNPKG

newspk

Version:

A TypeScript-based Node.js library for fetching latest news from Pakistani news sources (Dawn News) in English and Urdu.

41 lines 1.29 kB
"use strict"; /** * NewsPK - Pakistan News Scraper Library * * A lightweight Node.js library for fetching the latest news from Pakistani news sources. * Supports both English and Urdu languages. * * @packageDocumentation */ Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchNews = exports.news = void 0; const scraper_1 = require("./scraper"); Object.defineProperty(exports, "fetchNews", { enumerable: true, get: function () { return scraper_1.fetchNews; } }); /** * Fetches latest news articles with optional parameters * * @param limit - Number of articles to fetch (default: 5, max: 15) * @param lang - Language for news articles ('english' or 'urdu') (default: 'urdu') * @returns Promise resolving to an array of news articles * * @example * ```typescript * import { news } from 'newspk'; * * // Fetch 5 English news articles * const articles = await news(5, 'english'); * console.log(articles); * ``` * * @throws Error if news cannot be fetched or parsed */ const news = async (limit = 5, lang = 'urdu') => { return (0, scraper_1.fetchNews)(limit, lang); }; exports.news = news; // CommonJS compatibility export module.exports = { news: exports.news, fetchNews: scraper_1.fetchNews, }; //# sourceMappingURL=index.js.map