npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gensparkai-news

v1.0.0

Published

A browser-first JavaScript module for fetching AI-summarized multilingual news from Genspark AI's news feed

Downloads

11

Readme

GenSpark AI News Module (gensparkai-news)

A lightweight, zero-dependency JavaScript module for fetching AI-summarized, multilingual news from Genspark AI's news feed API. Perfect for building news apps, dashboards, RSS feeds, or integrating news into AI agents.

📦 Features

  • Multilingual Support - 14+ languages including English, Spanish, French, Chinese, Japanese, and more
  • AI-Generated Summaries - Automatic summarization of news articles
  • Audio News (Podcasts) - Optional podcast/audio versions of articles
  • No API Key Required - Works out of the box (as of December 2025)
  • Lightweight - Minimal dependencies, fast performance
  • Easy Pagination - Built-in offset/limit parameters
  • Category Filtering - Filter by news categories
  • Rich Metadata - Includes thumbnails, publish timestamps, sources, and speakers

🚀 Installation

Using npm

npm install gensparkai-news

Using bun

bun add gensparkai-news

Manual

Copy gensparkai_news.js into your project and import it.

💡 Usage

Basic Example

import { getNews } from 'gensparkai-news';

// Fetch default English news
const news = await getNews();
console.log(news.items);

Fetch Spanish News

import { getNews } from 'gensparkai-news';

const news = await getNews({
  locale: 'es-ES',
  limit: 20
});

news.items.forEach(article => {
  console.log(`📰 ${article.title}`);
  console.log(`📝 ${article.summary}`);
  console.log(`🔗 ${article.link}\n`);
});

Fetch News with Pagination

import { getNews } from 'gensparkai-news';

// Get news with pagination
const news = await getNews({
  locale: 'en-US',
  limit: 10,
  offset: 20  // Skip first 20 results
});

console.log(`Got ${news.count} articles`);
console.log(`Page offset: ${news.offset}`);

Fetch Category-Specific News

import { getNews } from 'gensparkai-news';

// Technology news in French
const news = await getNews({
  locale: 'fr-FR',
  categories: ['technology'],
  limit: 15
});

Use Convenience Functions

import {
  getEnglishNews,
  getSpanishNews,
  getFrenchNews,
  getChineseNews,
  getJapaneseNews,
  getPortugueseNews
} from 'gensparkai-news';

// Quick access to common languages
const enNews = await getEnglishNews(15);
const esNews = await getSpanishNews(20);
const frNews = await getFrenchNews();
const zhNews = await getChineseNews();

📋 API Reference

getNews(options)

Fetches news from Genspark AI with full customization.

Parameters: | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | locale | string | en-US | Language/region code (e.g., es-ES, fr-FR, zh-CN) | | limit | number | 10 | Number of articles to fetch (typically 10-30) | | offset | number | 0 | Pagination offset for fetching more results | | categories | array | [] | Category filters (e.g., ['technology', 'sports']) |

Returns: Promise resolving to an object with:

{
  count: number,           // Number of articles returned
  locale: string,          // The requested locale
  limit: number,           // The requested limit
  offset: number,          // The requested offset
  items: Array<Object>     // Array of news articles
}

Example:

const news = await getNews({
  locale: 'ja-JP',
  limit: 25,
  offset: 0,
  categories: ['business']
});

Convenience Functions

Quick shortcuts for popular languages:

  • getEnglishNews(limit) - Fetch English news
  • getSpanishNews(limit) - Fetch Spanish news (Spain)
  • getFrenchNews(limit) - Fetch French news
  • getChineseNews(limit) - Fetch Simplified Chinese news
  • getGermanNews(limit) - Fetch German news
  • getJapaneseNews(limit) - Fetch Japanese news
  • getPortugueseNews(limit) - Fetch Portuguese news (Brazil)

Example:

const articles = await getSpanishNews(20);

🌍 Supported Languages

| Language | Locale(s) | Best For | |----------|-----------|----------| | English | en-US | Default, widest coverage | | Spanish | es-ES, es-MX | Spain or Latin America | | French | fr-FR | France, Belgium, Switzerland | | German | de-DE | Germany, Austria | | Chinese (Simplified) | zh-CN | Mainland China | | Chinese (Traditional) | zh-TW | Taiwan, Hong Kong | | Japanese | ja-JP | Japan | | Portuguese | pt-BR, pt-PT | Brazil or Portugal | | Arabic | ar-SA | Arabic-speaking regions | | Hindi | hi-IN | India | | Korean | ko-KR | South Korea | | Italian | it-IT | Italy |

📂 Article Object Structure

Each article in the response contains:

{
  id: string,              // Unique article identifier
  title: string,           // Article title (in requested language)
  summary: string,         // AI-generated summary (in requested language)
  source: string,          // News source name
  published_ts: number,    // Unix timestamp of publication
  link: string,            // URL to original article
  thumbnail: string,       // Thumbnail image URL
  has_audio: boolean,      // Whether audio version exists
  audio_url: string|null,  // URL to podcast/audio (if available)
  audio_duration: number|null, // Duration in seconds
  speakers: Array<string>  // Narrators/speakers for audio version
}

🎯 Common Categories

These are common categories you can filter by (exact codes are undocumented):

const COMMON_CATEGORIES = [
  'world',
  'business',
  'technology',
  'tech',
  'sports',
  'entertainment',
  'health',
  'science',
  'politics'
];

Example:

import { getNews, COMMON_CATEGORIES } from 'gensparkai-news';

const techNews = await getNews({
  categories: ['technology'],
  limit: 15
});

📡 Constants

SUPPORTED_LOCALES

Object containing metadata about all supported locales:

import { SUPPORTED_LOCALES } from 'gensparkai-news';

console.log(SUPPORTED_LOCALES);
// Output:
// {
//   'en-US': { name: 'English', region: 'United States' },
//   'es-ES': { name: 'Spanish', region: 'Spain' },
//   ...
// }

COMMON_CATEGORIES

Array of common news categories for filtering:

import { COMMON_CATEGORIES } from 'gensparkai-news';

console.log(COMMON_CATEGORIES);
// ['world', 'business', 'technology', 'tech', ...]

🔧 Error Handling

The module throws descriptive errors for invalid parameters or API failures:

import { getNews } from 'gensparkai-news';

try {
  const news = await getNews({
    locale: 'invalid-locale',
    limit: -5  // Invalid!
  });
} catch (error) {
  console.error('Error:', error.message);
  // "Limit must be a positive number"
  // "Invalid locale parameter"
  // "Failed to fetch news: ..."
}

📝 Complete Examples

import { getNews } from 'gensparkai-news';

async function buildDashboard() {
  const [enNews, esNews, frNews] = await Promise.all([
    getNews({ locale: 'en-US', limit: 5 }),
    getNews({ locale: 'es-ES', limit: 5 }),
    getNews({ locale: 'fr-FR', limit: 5 })
  ]);

  console.log('🇺🇸 Top English News:');
  enNews.items.forEach(item => console.log(`  - ${item.title}`));

  console.log('\n🇪🇸 Top Spanish News:');
  esNews.items.forEach(item => console.log(`  - ${item.title}`));

  console.log('\n🇫🇷 Top French News:');
  frNews.items.forEach(item => console.log(`  - ${item.title}`));
}

buildDashboard();

Example 2: Podcast Extractor

import { getNews } from 'gensparkai_news';

async function getPodcasts() {
  const news = await getNews({ limit: 50 });
  
  const podcasts = news.items.filter(item => item.has_audio);
  
  console.log(`Found ${podcasts.length} podcast articles:`);
  podcasts.forEach(podcast => {
    console.log(`
      Title: ${podcast.title}
      Duration: ${podcast.audio_duration} seconds
      Speakers: ${podcast.speakers.join(', ')}
      Audio: ${podcast.audio_url}
    `);
  });
}

getPodcasts();

Example 3: Multi-Language News Feed

import { getNews, SUPPORTED_LOCALES } from 'gensparkai_news';

async function getNewsForAllLanguages(limit = 3) {
  const results = {};
  
  for (const [locale, info] of Object.entries(SUPPORTED_LOCALES)) {
    try {
      const news = await getNews({ locale, limit });
      results[locale] = {
        language: info.name,
        region: info.region,
        articles: news.items.map(item => ({
          title: item.title,
          summary: item.summary
        }))
      };
      console.log(`✅ Fetched ${info.name} (${locale})`);
    } catch (error) {
      console.error(`❌ Failed to fetch ${info.name}: ${error.message}`);
    }
  }
  
  return results;
}

const allNews = await getNewsForAllLanguages();

🌐 Server/API Integration

Use with Express.js or Bun server:

import { getNews } from 'gensparkai_news';

// Bun server example
Bun.serve({
  port: 3000,
  async fetch(req) {
    const url = new URL(req.url);
    
    if (url.pathname === '/api/news') {
      const locale = url.searchParams.get('locale') || 'en-US';
      const limit = Number(url.searchParams.get('limit') || 10);
      
      try {
        const news = await getNews({ locale, limit });
        return Response.json(news);
      } catch (error) {
        return Response.json({ error: error.message }, { status: 500 });
      }
    }
    
    return new Response('Not Found', { status: 404 });
  }
});

⚠️ Important Notes

  • No API Key Required - This module works without authentication (as of December 2025)
  • Undocumented Endpoint - Uses Genspark's internal news API, which may change
  • Rate Limiting - Be respectful with request frequency to avoid service disruption
  • Category Filtering - Exact category codes are undocumented; common ones are provided
  • Localization - Responses are fully localized to the requested language
  • Quality by Locale - Some locales have better coverage than others; English has the widest selection

📄 Response Format

All API calls return a consistent structure:

{
  count: 10,
  locale: 'es-ES',
  limit: 10,
  offset: 0,
  items: [
    {
      id: 'article-123',
      title: 'Título del artículo',
      summary: 'Resumen generado por IA...',
      source: 'El País',
      published_ts: 1735680000,
      link: 'https://example.com',
      thumbnail: 'https://example.com/image.jpg',
      has_audio: true,
      audio_url: 'https://example.com/audio.mp3',
      audio_duration: 300,
      speakers: ['Narrator']
    },
    // ... more items
  ]
}

🤝 Contributing

Found a bug or have a suggestion? Feel free to report it or submit improvements.

📜 License

MIT License - Use freely in your projects!

🎯 Use Cases

  • News Aggregation - Build personal news feeds across multiple languages
  • AI Chatbots - Feed current news into your AI agents
  • Dashboard Applications - Create real-time news dashboards
  • Content Curation - Automatically summarize and organize news
  • RSS Feeds - Generate custom RSS feeds from Genspark news
  • Mobile Apps - Lightweight module for news applications
  • Data Analysis - Collect news data for NLP/ML projects

Last Updated: December 27, 2025
Status: ✅ Working and tested
Dependencies: None (pure JavaScript/Node.js)

Questions? Check the examples above or inspect the JSDoc comments in the module file.