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 🙏

© 2025 – Pkg Stats / Ryan Hefner

google-trends-litelo

v1.0.1

Published

A lightweight Node.js package for scraping Google Trends data from India, US and UK using Puppeteer

Readme

Google Trends LiteLo V 1.0.0

A lightweight Node.js package for scraping Google Trends data from India, US and UK using Puppeteer. This package provides easy-to-use methods to get trending topics for different time periods. More data will be made accessible with upcoming versions.

Features

  • 🌍 Support for 3 countries: India, US, UK
  • ⏰ Multiple time ranges: 4 hours, 24 hours, 48 hours, 7 days
  • 📊 Top 25 trending topics
  • 🔄 Built-in retry mechanism and rate limiting
  • 📦 Simple JSON response format
  • 🚀 Easy to integrate into any Node.js project

Installation

npm install google-trends-litelo

Quick Start

import { googleTrendsAPI } from "google-trends-LiteLo";

// Get India trends for last 24 hours
const indiaTrends = await googleTrendsAPI.getIndiaTrends24h();
console.log(indiaTrends);

// Get US trends for last 4 hours
const usTrends = await googleTrendsAPI.getUSTrends4h();
console.log(usTrends);

// Get UK trends for last 7 days
const ukTrends = await googleTrendsAPI.getUKTrends7d();
console.log(ukTrends);

API Reference

Available Methods

India Trends

  • getIndiaTrends4h() - Get top 25 trends from India for last 4 hours
  • getIndiaTrends24h() - Get top 25 trends from India for last 24 hours
  • getIndiaTrends48h() - Get top 25 trends from India for last 48 hours
  • getIndiaTrends7d() - Get top 25 trends from India for last 7 days

US Trends

  • getUSTrends4h() - Get top 25 trends from US for last 4 hours
  • getUSTrends24h() - Get top 25 trends from US for last 24 hours
  • getUSTrends48h() - Get top 25 trends from US for last 48 hours
  • getUSTrends7d() - Get top 25 trends from US for last 7 days

UK Trends

  • getUKTrends4h() - Get top 25 trends from UK for last 4 hours
  • getUKTrends24h() - Get top 25 trends from UK for last 24 hours
  • getUKTrends48h() - Get top 25 trends from UK for last 48 hours
  • getUKTrends7d() - Get top 25 trends from UK for last 7 days

Generic Method

  • getTrends(country, hours, limit) - Get trends for any supported country and time period

Response Format

{
  "success": true,
  "country": "IN",
  "timeRange": "24 hours",
  "totalTrends": 25,
  "scrapingDuration": "5432ms",
  "scrapedAt": "2025-06-20T10:30:00.000Z",
  "trends": [
    {
      "rank": 1,
      "title": "Trending Topic Name",
      "country": "IN",
      "timeRange": "24h",
      "scrapedAt": "2025-06-20T10:30:00.000Z"
    },
    // ... more trends
  ]
}

Error Response

{
  "success": false,
  "error": "Error message",
  "country": "IN",
  "timeRange": "24 hours"
}

Usage Examples

Basic Usage

import { googleTrendsAPI } from "google-trends-LiteLo";

async function getTrendingTopics() {
  try {
    // Get trending topics from different countries
    const [india, us, uk] = await Promise.all([
      googleTrendsAPI.getIndiaTrends24h(),
      googleTrendsAPI.getUSTrends24h(),
      googleTrendsAPI.getUKTrends24h(),
    ]);

    console.log("India Trends:", india.trends.slice(0, 5));
    console.log("US Trends:", us.trends.slice(0, 5));
    console.log("UK Trends:", uk.trends.slice(0, 5));
  } catch (error) {
    console.error("Error fetching trends:", error);
  }
}

getTrendingTopics();

Class-based Usage

import GoogleTrendsAPI from "google-trends-LiteLo";

const trendsAPI = new GoogleTrendsAPI();

async function fetchTrends() {
  try {
    const trends = await trendsAPI.getIndiaTrends4h();
    console.log(trends);
  } catch (error) {
    console.error("Error:", error);
  }
}

fetchTrends();

Requirements

  • Node.js >= 16.0.0
  • Chrome/Chromium browser

Supported Countries

  • India: IN
  • United States: US
  • United Kingdom: GB

Time Periods

  • 4 hours: Recent trending topics
  • 24 hours: Daily trending topics
  • 48 hours: 2-day trending topics
  • 7 days: Weekly trending topics

Development

# Install dependencies
npm install

# Run tests
npm test

# Start development mode
npm run dev

Testing

Run the test file to verify the package works correctly:

npm test

This will test all methods and display sample results.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License.

Disclaimer

This package scrapes publicly available data from Google Trends. Please use responsibly and in accordance with Google's Terms of Service. The package includes rate limiting to be respectful of Google's servers.

Support

If you encounter any issues or have questions, contant me via my email.

Email - [email protected]