# npm Package Scraper - Downloads, Deps & Metadata (`viralanalyzer/npm-package-intelligence`) Actor

Extract NPM package data: downloads, dependencies, versions, maintainers, and README. Track JavaScript ecosystem trends.

- **URL**: https://apify.com/viralanalyzer/npm-package-intelligence.md
- **Developed by:** [viralanalyzer](https://apify.com/viralanalyzer) (community)
- **Categories:** Developer tools, Other
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $15.75 / 1,000 package scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## 📦 NPM Package Intelligence — Package Data, Scores & Download Stats

> 🔗 [View on Apify Store](https://apify.com/viralanalyzer/npm-package-intelligence) | 🇺🇸 English | [🇧🇷 Português](#português)

Scrape **NPM package metadata, quality scores, and download statistics** using the public NPM registry API. Search by **keyword**, browse **popular packages**, or get full details for **specific package names** — including weekly/monthly downloads, maintainer info, and NPM scores.

### ✨ Features

- 🔍 **Keyword search** — Find packages by keyword with NPM's search API
- 🏆 **Popular packages** — Browse top packages sorted by popularity score
- 📦 **Specific packages** — Get full registry details for exact package names
- 📊 **Download stats** — Weekly download counts and daily monthly breakdown
- ⭐ **NPM scores** — Quality, popularity, maintenance, and overall scores
- 👥 **Maintainer info** — Publisher username and maintainer count
- 🔗 **Repository links** — Homepage, GitHub repo, and NPM page URLs
- 🛡️ **Anti-placeholder guardrails** — Only real data, never fake results

### 📥 Input

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `mode` | String | Yes | `search` | Scraping mode: `search`, `popular`, or `by_packages` |
| `searchQueries` | Array | In `search`/`popular` modes | — | Keywords to search for (max 10 queries) |
| `packageNames` | Array | In `by_packages` mode | — | Exact NPM package names (max 200) |
| `maxItems` | Integer | No | `50` | Maximum packages per search query (1–200) |
| `includeDownloads` | Boolean | No | `true` | Fetch weekly and monthly download counts |

#### Input Example

```json
{
    "mode": "search",
    "searchQueries": ["react", "machine learning"],
    "maxItems": 25,
    "includeDownloads": true
}
```

### 📤 Output

| Field | Type | Description |
|-------|------|-------------|
| `name` | String | Package name |
| `version` | String | Latest version number |
| `description` | String | Package description |
| `keywords` | Array | Package keywords/tags |
| `homepage` | String | Project homepage URL |
| `repositoryUrl` | String | Source code repository URL |
| `npmUrl` | String | NPM package page URL |
| `weeklyDownloads` | Integer | Downloads in the last 7 days |
| `monthlyDownloads` | Array | Daily download counts for the last 30 days |
| `publisher` | String | Publisher username |
| `maintainerCount` | Integer | Number of maintainers |
| `qualityScore` | Float | NPM quality score (0–1) |
| `popularityScore` | Float | NPM popularity score (0–1) |
| `maintenanceScore` | Float | NPM maintenance score (0–1) |
| `overallScore` | Float | NPM overall score (0–1) |
| `lastPublished` | String | Date of last publish (ISO 8601) |
| `license` | String | Package license (in `by_packages` mode) |
| `created` | String | Package creation date (in `by_packages` mode) |
| `dependencyCount` | Integer | Total dependencies (in `by_packages` mode) |
| `platform` | String | Always `npm` |
| `scrapedAt` | String | Timestamp of data extraction (ISO 8601) |

#### Output Example

```json
{
    "name": "react",
    "version": "19.0.0",
    "description": "The library for web and native user interfaces.",
    "keywords": ["react"],
    "homepage": "https://react.dev/",
    "repositoryUrl": "https://github.com/facebook/react",
    "npmUrl": "https://www.npmjs.com/package/react",
    "weeklyDownloads": 27845631,
    "monthlyDownloads": [
        { "day": "2026-02-04", "downloads": 4125890 },
        { "day": "2026-02-05", "downloads": 4356712 }
    ],
    "publisher": "",
    "maintainerCount": 3,
    "qualityScore": null,
    "popularityScore": null,
    "maintenanceScore": null,
    "overallScore": null,
    "license": "MIT",
    "created": "2011-10-26T17:46:21.942Z",
    "lastPublished": "2025-12-05T20:12:45.876Z",
    "dependencyCount": 2,
    "platform": "npm",
    "scrapedAt": "2026-03-06T14:30:00.000Z"
}
```

### 📋 Use Cases

- 📊 **Technology radar** — Track adoption trends of frameworks and libraries by download volume
- 🏢 **Competitive analysis** — Compare similar packages by quality, popularity, and maintenance scores
- 🔍 **Dependency auditing** — Analyze package health metrics before adding to your project
- 📈 **Market research** — Identify growing ecosystems and emerging tools in the JavaScript world
- 🤖 **Automated reporting** — Feed package data into dashboards for DevOps or engineering teams
- 📰 **Developer newsletters** — Curate trending and noteworthy packages for weekly digests

### ✅ Capabilities & Limits

Stated up front, so you do not pay a run to find out.

**Built here:** `dependencyCount`, returned only in `by_packages` mode, is the sum of `dependencies` and `devDependencies` of the `latest` version, not the runtime dependency count. It is not comparable to what `npm ls` or a bundle-weight analysis shows, and a package with few runtime deps but a large dev toolchain scores high.

| Input / feature | Supported | Notes |
|---|---|---|
| Mode | ✅ | `mode` — required: `search`, `popular`, `by_packages` |
| Keyword search | ✅ | `searchQueries` — used in `search` and `popular` |
| Exact package names | ✅ | `packageNames` — used in `by_packages` |
| Download counts | ✅ | `includeDownloads` — weekly and monthly; slightly slower |
| Private / scoped-private packages | ❌ | public npm registry only |
| Source code | ❌ | metadata, dependencies and downloads — not file contents |
| Vulnerability data | ❌ | not an audit tool; use `npm audit` for that |
| Result volume | ⚠️ | `maxItems` per search query |

### ❓ FAQ

**Q: What is the difference between `search`, `popular`, and `by_packages` modes?**
A: `search` finds packages by keyword (sorted by relevance), `popular` sorts results by NPM popularity score, and `by_packages` fetches full registry details for specific package names you provide.

**Q: Why are some scores null in `by_packages` mode?**
A: Quality, popularity, maintenance, and overall scores are only available through the NPM search API. In `by_packages` mode, data is fetched directly from the registry, which provides richer details (license, creation date, dependencies) but not the search-specific scores.

**Q: Does enabling `includeDownloads` make the scrape slower?**
A: Yes, slightly. Each package requires two extra API calls (weekly + monthly downloads) with a 500ms rate-limit delay. For 50 packages, this adds about 50 seconds of extra runtime.

**Q: Can I scrape scoped packages (e.g., @angular/core)?**
A: Yes, in `by_packages` mode you can provide scoped package names like `@angular/core`, `@types/react`, etc. The actor handles URL encoding automatically.

**Q: What happens if a package name does not exist?**
A: The actor logs a warning and skips the missing package. If all packages are missing and zero results are found, the actor throws an explicit error.

### 💰 Pricing

This actor uses **Pay Per Event (PPE)** pricing:

| Metric | Cost |
|--------|------|
| Per package scraped | $0.03 |

### 🔗 Related Actors

- [ArXiv Paper Intelligence](https://apify.com/viralanalyzer/arxiv-paper-intelligence) — Scrape academic papers from ArXiv with full metadata
- [GitHub Trending Scraper](https://apify.com/viralanalyzer/github-trending-scraper) — Trending repositories and developers on GitHub
- [Stack Overflow Scraper](https://apify.com/viralanalyzer/stackoverflow-scraper) — Questions, answers, and tags from Stack Overflow
- [Wikipedia Trending Pages](https://apify.com/viralanalyzer/wikipedia-trending) — Most-viewed Wikipedia articles and pageview history

### 📝 Changelog

#### v1.0 (Current)

- ✅ Search packages by keyword with NPM search API
- ✅ Browse popular packages sorted by popularity score
- ✅ Fetch full registry details for specific package names
- ✅ Weekly and monthly download statistics
- ✅ NPM quality, popularity, maintenance, and overall scores
- ✅ Deduplication by package name
- ✅ Anti-placeholder guardrails — real data only
- ✅ PPE billing via Actor.charge()

***

<a name="português"></a>

## 📦 NPM Package Intelligence — Dados de Pacotes, Scores e Estatísticas de Download

> [🇺🇸 English](#-npm-package-intelligence--package-data-scores--download-stats) | 🇧🇷 Português

Extraia **metadados, scores de qualidade e estatísticas de download de pacotes NPM** usando a API pública do registro NPM. Pesquise por **palavra-chave**, navegue por **pacotes populares**, ou obtenha detalhes completos de **pacotes específicos** — incluindo downloads semanais/mensais, informações de mantenedores e scores do NPM.

### ✨ Funcionalidades

- 🔍 **Pesquisa por palavra-chave** — Encontre pacotes por palavra-chave com a API de busca do NPM
- 🏆 **Pacotes populares** — Navegue pelos pacotes mais populares ordenados por score de popularidade
- 📦 **Pacotes específicos** — Obtenha detalhes completos do registro para nomes exatos de pacotes
- 📊 **Estatísticas de download** — Contagem semanal e detalhamento diário mensal
- ⭐ **Scores do NPM** — Qualidade, popularidade, manutenção e score geral
- 👥 **Informações de mantenedores** — Nome de usuário do publicador e número de mantenedores
- 🔗 **Links de repositório** — URLs da homepage, repositório GitHub e página NPM
- 🛡️ **Proteção anti-placeholder** — Apenas dados reais, nunca resultados falsos

### 📥 Entrada

| Parâmetro | Tipo | Obrigatório | Padrão | Descrição |
|-----------|------|-------------|--------|-----------|
| `mode` | String | Sim | `search` | Modo de extração: `search`, `popular` ou `by_packages` |
| `searchQueries` | Array | Nos modos `search`/`popular` | — | Palavras-chave para pesquisar (máximo 10 consultas) |
| `packageNames` | Array | No modo `by_packages` | — | Nomes exatos de pacotes NPM (máximo 200) |
| `maxItems` | Integer | Não | `50` | Máximo de pacotes por consulta de busca (1–200) |
| `includeDownloads` | Boolean | Não | `true` | Buscar contagens de download semanais e mensais |

#### Exemplo de Entrada

```json
{
    "mode": "search",
    "searchQueries": ["react", "machine learning"],
    "maxItems": 25,
    "includeDownloads": true
}
```

### 📤 Saída

| Campo | Tipo | Descrição |
|-------|------|-----------|
| `name` | String | Nome do pacote |
| `version` | String | Número da versão mais recente |
| `description` | String | Descrição do pacote |
| `keywords` | Array | Palavras-chave/tags do pacote |
| `homepage` | String | URL da homepage do projeto |
| `repositoryUrl` | String | URL do repositório de código-fonte |
| `npmUrl` | String | URL da página do pacote no NPM |
| `weeklyDownloads` | Integer | Downloads nos últimos 7 dias |
| `monthlyDownloads` | Array | Contagem diária de downloads dos últimos 30 dias |
| `publisher` | String | Nome de usuário do publicador |
| `maintainerCount` | Integer | Número de mantenedores |
| `qualityScore` | Float | Score de qualidade do NPM (0–1) |
| `popularityScore` | Float | Score de popularidade do NPM (0–1) |
| `maintenanceScore` | Float | Score de manutenção do NPM (0–1) |
| `overallScore` | Float | Score geral do NPM (0–1) |
| `lastPublished` | String | Data da última publicação (ISO 8601) |
| `license` | String | Licença do pacote (no modo `by_packages`) |
| `created` | String | Data de criação do pacote (no modo `by_packages`) |
| `dependencyCount` | Integer | Total de dependências (no modo `by_packages`) |
| `platform` | String | Sempre `npm` |
| `scrapedAt` | String | Timestamp da extração dos dados (ISO 8601) |

#### Exemplo de Saída

```json
{
    "name": "react",
    "version": "19.0.0",
    "description": "The library for web and native user interfaces.",
    "keywords": ["react"],
    "homepage": "https://react.dev/",
    "repositoryUrl": "https://github.com/facebook/react",
    "npmUrl": "https://www.npmjs.com/package/react",
    "weeklyDownloads": 27845631,
    "monthlyDownloads": [
        { "day": "2026-02-04", "downloads": 4125890 },
        { "day": "2026-02-05", "downloads": 4356712 }
    ],
    "publisher": "",
    "maintainerCount": 3,
    "qualityScore": null,
    "popularityScore": null,
    "maintenanceScore": null,
    "overallScore": null,
    "license": "MIT",
    "created": "2011-10-26T17:46:21.942Z",
    "lastPublished": "2025-12-05T20:12:45.876Z",
    "dependencyCount": 2,
    "platform": "npm",
    "scrapedAt": "2026-03-06T14:30:00.000Z"
}
```

### 📋 Casos de Uso

- 📊 **Radar tecnológico** — Acompanhe tendências de adoção de frameworks e bibliotecas por volume de downloads
- 🏢 **Análise competitiva** — Compare pacotes similares por qualidade, popularidade e scores de manutenção
- 🔍 **Auditoria de dependências** — Analise métricas de saúde de pacotes antes de adicioná-los ao seu projeto
- 📈 **Pesquisa de mercado** — Identifique ecossistemas em crescimento e ferramentas emergentes no mundo JavaScript
- 🤖 **Relatórios automatizados** — Alimente dados de pacotes em dashboards para equipes de DevOps ou engenharia
- 📰 **Newsletters para devs** — Selecione pacotes em tendência e notáveis para resumos semanais

### ❓ Perguntas Frequentes

**P: Qual é a diferença entre os modos `search`, `popular` e `by_packages`?**
R: `search` encontra pacotes por palavra-chave (ordenados por relevância), `popular` ordena resultados pelo score de popularidade do NPM, e `by_packages` busca detalhes completos do registro para nomes de pacotes específicos que você fornecer.

**P: Por que alguns scores são null no modo `by_packages`?**
R: Os scores de qualidade, popularidade, manutenção e geral só estão disponíveis pela API de busca do NPM. No modo `by_packages`, os dados são buscados diretamente do registro, que fornece detalhes mais ricos (licença, data de criação, dependências), mas não os scores específicos da busca.

**P: Habilitar `includeDownloads` torna a extração mais lenta?**
R: Sim, ligeiramente. Cada pacote requer duas chamadas extras à API (downloads semanais + mensais) com um atraso de 500ms para rate limit. Para 50 pacotes, isso adiciona cerca de 50 segundos ao tempo de execução.

**P: Posso extrair pacotes com escopo (ex.: @angular/core)?**
R: Sim, no modo `by_packages` você pode fornecer nomes de pacotes com escopo como `@angular/core`, `@types/react`, etc. O actor lida com a codificação de URL automaticamente.

**P: O que acontece se um nome de pacote não existir?**
R: O actor registra um aviso e pula o pacote ausente. Se todos os pacotes estiverem ausentes e zero resultados forem encontrados, o actor lança um erro explícito.

### 💰 Preços

Este actor usa precificação **Pay Per Event (PPE)**:

| Métrica | Custo |
|---------|-------|
| Por pacote extraído | $0,03 |

### 🔗 Actors Relacionados

- [ArXiv Paper Intelligence](https://apify.com/viralanalyzer/arxiv-paper-intelligence) — Extraia artigos acadêmicos do ArXiv com metadados completos
- [GitHub Trending Scraper](https://apify.com/viralanalyzer/github-trending-scraper) — Repositórios e desenvolvedores em tendência no GitHub
- [Stack Overflow Scraper](https://apify.com/viralanalyzer/stackoverflow-scraper) — Perguntas, respostas e tags do Stack Overflow
- [Wikipedia Trending Pages](https://apify.com/viralanalyzer/wikipedia-trending) — Artigos mais visualizados da Wikipédia e histórico de visualizações

### 📝 Changelog

#### v1.0 (Atual)

- ✅ Pesquisa de pacotes por palavra-chave com API de busca do NPM
- ✅ Navegação por pacotes populares ordenados por score de popularidade
- ✅ Busca de detalhes completos do registro para pacotes específicos
- ✅ Estatísticas de download semanais e mensais
- ✅ Scores de qualidade, popularidade, manutenção e geral do NPM
- ✅ Deduplicação por nome de pacote
- ✅ Proteção anti-placeholder — apenas dados reais
- ✅ Cobrança PPE via Actor.charge()

# Actor input Schema

## `mode` (type: `string`):

What data to collect: search by keyword, browse popular packages, or get details for specific package names.

## `searchQueries` (type: `array`):

Keywords to search for (used in 'search' and 'popular' modes).

## `packageNames` (type: `array`):

Exact NPM package names to fetch full details for (used in 'by\_packages' mode).

## `maxItems` (type: `integer`):

Maximum number of packages to scrape per search query.

## `includeDownloads` (type: `boolean`):

Fetch weekly and monthly download counts for each package (slightly slower).

## Actor input object example

```json
{
  "mode": "search",
  "searchQueries": [
    "react",
    "machine learning"
  ],
  "packageNames": [
    "react",
    "express",
    "lodash"
  ],
  "maxItems": 10,
  "includeDownloads": true
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset containing all scraped results. Each item follows the dataset schema.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQueries": [
        "react",
        "machine learning"
    ],
    "packageNames": [
        "react",
        "express",
        "lodash"
    ],
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("viralanalyzer/npm-package-intelligence").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchQueries": [
        "react",
        "machine learning",
    ],
    "packageNames": [
        "react",
        "express",
        "lodash",
    ],
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("viralanalyzer/npm-package-intelligence").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchQueries": [
    "react",
    "machine learning"
  ],
  "packageNames": [
    "react",
    "express",
    "lodash"
  ],
  "maxItems": 10
}' |
apify call viralanalyzer/npm-package-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,viralanalyzer/npm-package-intelligence"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Vmov1BF99JiOn7VBo/builds/kJbOpO9WjbbFBLtQH/openapi.json
