# Pub.dev Dart Package Metadata Scraper (`ahmdshrif/pub-dev-package-metadata-scraper`) Actor

Exports version, dependency, pub points, likes and popularity data for Dart and Flutter packages pulled directly from pub.dev's official JSON API.

- **URL**: https://apify.com/ahmdshrif/pub-dev-package-metadata-scraper.md
- **Developed by:** [Ahmed](https://apify.com/ahmdshrif) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$20.00 / 1,000 run starteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## Pub.dev Dart Package Metadata Scraper

Exports version, dependency, pub points, likes, and popularity data for Dart and Flutter packages, pulled directly from pub.dev's official JSON API. Built for Dart/Flutter developers evaluating packages, dependency-audit tooling, and anyone tracking the pub.dev ecosystem who needs structured package data without scraping HTML.

### Why this scraper

- Reads pub.dev's official JSON API (package + score endpoints) rather than rendered HTML, so version history, dependencies, and SDK constraints come back as structured fields instead of parsed page text.
- Returns pub points, likes, and popularity score alongside those metadata fields in one flat row per package — data that's often split across multiple sources or only partially available elsewhere.
- Priced lower than the cheapest priced alternative on a per-run basis.

### Output fields

| Field | Type | Description |
|---|---|---|
| packageName | string | The pub.dev package identifier, e.g. 'http'. |
| latestVersion | string | Version string of the latest published release. |
| description | string | Package description from its pubspec. |
| repositoryUrl | string | Source repository URL declared in the pubspec, if any. |
| publishedAt | string | ISO 8601 timestamp the latest version was published. |
| sdkConstraint | string | Dart SDK version constraint required by the latest release. |
| topics | string | Comma-separated list of package topics/tags. |
| dependencies | string | Comma-separated list of direct runtime dependency names. |
| versionCount | integer | Total number of versions ever published for this package. |
| likeCount | integer | Number of pub.dev user likes, from the package score endpoint. |
| pubPoints | integer | Granted pub points out of the maximum possible score. |
| maxPubPoints | integer | Maximum pub points achievable, for computing a percentage. |
| popularityScore | number | Pub.dev popularity score between 0 and 1. |

### Input

```json
{
  "startUrls": [
    { "url": "https://pub.dev/api/packages/http" }
  ],
  "maxItems": 50
}
```

### Output

```json
{
  "packageName": "http",
  "latestVersion": "1.6.0",
  "description": "A composable, multi-platform, Future-based API for HTTP requests.",
  "repositoryUrl": "https://github.com/dart-lang/http/tree/master/pkgs/http",
  "publishedAt": "2025-11-10T18:27:56.434747Z",
  "sdkConstraint": "^3.4.0",
  "topics": "http,network,protocols",
  "dependencies": "async,http_parser,meta,web",
  "versionCount": 130,
  "likeCount": null,
  "pubPoints": null,
  "maxPubPoints": null,
  "popularityScore": null
}
```

### Pricing

Pay-per-event: **$0.02 per run started**, charged once regardless of how many packages are listed in `startUrls`. A typical run covering a handful of packages (e.g. checking `http`, `provider`, and `dio`) costs $0.02 total.

### Use cases

- Auditing a Flutter app's `pubspec.yaml` dependencies for SDK constraint compatibility before a Dart SDK upgrade.
- Building a package-comparison dashboard that ranks alternatives by pub points, likes, and popularity score.
- Monitoring a set of packages you depend on for new version releases and dependency changes over time.

# Actor input Schema

## `startUrls` (type: `array`):

Pages to export.

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

Stop after this many records.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://pub.dev/api/packages/http"
    },
    {
      "url": "https://pub.dev/api/packages/provider"
    },
    {
      "url": "https://pub.dev/api/packages/dio"
    }
  ],
  "maxItems": 50
}
```

# Actor output Schema

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

One structured record per input URL.

# 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 = {
    "startUrls": [
        {
            "url": "https://pub.dev/api/packages/http"
        },
        {
            "url": "https://pub.dev/api/packages/provider"
        },
        {
            "url": "https://pub.dev/api/packages/dio"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ahmdshrif/pub-dev-package-metadata-scraper").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 = { "startUrls": [
        { "url": "https://pub.dev/api/packages/http" },
        { "url": "https://pub.dev/api/packages/provider" },
        { "url": "https://pub.dev/api/packages/dio" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ahmdshrif/pub-dev-package-metadata-scraper").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 '{
  "startUrls": [
    {
      "url": "https://pub.dev/api/packages/http"
    },
    {
      "url": "https://pub.dev/api/packages/provider"
    },
    {
      "url": "https://pub.dev/api/packages/dio"
    }
  ]
}' |
apify call ahmdshrif/pub-dev-package-metadata-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ahmdshrif/pub-dev-package-metadata-scraper"
        }
    }
}

```

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/xWGeeag2fmOQGI2bm/builds/mAWHbaAT55zjCkcOW/openapi.json
