# RubyGems Package Scraper - Ruby Gem Downloads & Dependencies (`scrapers_lat/rubygems-packages-scraper`) Actor

Search and inspect RubyGems.org gems: total and version downloads, versions, runtime dependencies, license, authors, links and reverse-dependency impact. Export to JSON, CSV or Excel. Optional AI gem classification.

- **URL**: https://apify.com/scrapers\_lat/rubygems-packages-scraper.md
- **Developed by:** [Scrapers Lat](https://apify.com/scrapers_lat) (community)
- **Categories:** Developer tools, AI, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.32 / 1,000 results

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/platform/actors/running/actors-in-store#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

[![RubyGems Package Scraper - Ruby Gem Downloads & Dependencies](https://scrapers.lat/banners/rubygems-packages-scraper.png)](https://apify.com/scrapers_lat/rubygems-packages-scraper)

## RubyGems Package Scraper - Ruby Gem Downloads & Dependencies

Ruby package intelligence from RubyGems.org. Search or look up gems and get download stats, dependencies, license, authors, links, and reverse-dependency ecosystem impact in one normalized record.

Here is one real result, with every field the actor returns:

```json
{
  "name": "sinatra",
  "description": "Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort.",
  "latestVersion": "4.2.1",
  "platform": "ruby",
  "totalDownloads": 352872397,
  "versionDownloads": 11208396,
  "licenses": ["MIT"],
  "authors": "Blake Mizerany, Ryan Tomayko, Simon Rozet, Konstantin Haase",
  "homepageUrl": "http://sinatrarb.com/",
  "sourceUrl": "https://github.com/sinatra/sinatra",
  "projectUrl": "https://rubygems.org/gems/sinatra",
  "documentationUrl": "https://www.rubydoc.info/gems/sinatra",
  "changelogUrl": "https://github.com/sinatra/sinatra/blob/main/CHANGELOG.md",
  "bugTrackerUrl": "https://github.com/sinatra/sinatra/issues",
  "gemUri": "https://rubygems.org/gems/sinatra-4.2.1.gem",
  "runtimeDependencies": [
    { "name": "logger", "requirements": ">= 1.6.0" },
    { "name": "mustermann", "requirements": "~> 3.0" },
    { "name": "rack", "requirements": ">= 3.0.0, < 4" },
    { "name": "rack-protection", "requirements": "= 4.2.1" },
    { "name": "rack-session", "requirements": ">= 2.0.0, < 3" },
    { "name": "tilt", "requirements": "~> 2.0" }
  ],
  "runtimeDependencyCount": 6,
  "developmentDependencyCount": 0,
  "sha": "b7aeb9b11d046b552972ade834f1f9be98b185fa8444480688e3627625377080",
  "yanked": false,
  "versionCreatedAt": "2025-10-10T15:20:36.806Z",
  "reverseDependencyCount": 3070,
  "reverseDependencies": ["mpayer_ruby", "sinatra_cyclist", "gitall"],
  "aiSummary": {
    "whatItDoes": "Sinatra is a lightweight framework for building web applications in Ruby with ease.",
    "category": "Web Framework",
    "alternativeTo": "Ruby on Rails",
    "targetUser": "Web developers"
  },
  "source": "rubygems",
  "observedAt": "2026-08-17T10:23:38.913Z",
  "error": null
}
```

The most complete RubyGems scraper available. It pairs total and per-version download counts with the full runtime dependency list, license, authors, and every project link, then optionally adds reverse-dependency impact (which gems depend on this one) and a short AI classification. Missing source values are returned as `null`.

**📥 [Input](https://apify.com/scrapers_lat/rubygems-packages-scraper/input-schema) · 📤 [Output](https://apify.com/scrapers_lat/rubygems-packages-scraper/output-schema) · 💰 [Pricing](https://apify.com/scrapers_lat/rubygems-packages-scraper/pricing) · ▶️ [Examples](https://apify.com/scrapers_lat/rubygems-packages-scraper/examples)**

![Apify](https://img.shields.io/badge/Platform-Apify-1CE1CE?logo=apify\&logoColor=white)
![Coverage](https://img.shields.io/badge/Coverage-RubyGems.org-blue)
![Output](https://img.shields.io/badge/Output-JSON%20%7C%20CSV%20%7C%20Excel-orange)
![Billing](https://img.shields.io/badge/Billing-Pay%20per%20result-brightgreen)

### Table of contents

- [What it does](#what-it-does)
- [Quickstart](#quickstart)
- [Input reference](#input-reference)
- [Output reference](#output-reference)
- [Use cases](#use-cases)
- [Run via API and CLI](#run-via-api-and-cli)
- [Billing and limits](#billing-and-limits)
- [FAQ and troubleshooting](#faq-and-troubleshooting)

### What it does

The actor talks to the public RubyGems.org registry in two modes. In **search** mode it queries by keyword and paginates through matching gems. In **gem** mode it looks up an exact list of gem names. For each gem it writes one normalized record with the total download count, the latest version and its download count, the full runtime dependency list (name plus version requirement), the development dependency count, license(s), authors, checksum, yanked status, and every project link (homepage, source code, documentation, changelog, bug tracker, RubyGems page). Two optional add-ons enrich each gem: reverse dependencies (the count and a sample of gems that depend on it) and an AI classification of what the gem does.

### Quickstart

Open the actor, paste this into the input, and press Run. It returns the 10 most relevant gems for the keyword `json`.

```json
{
  "mode": "search",
  "query": "json",
  "maxResults": 10
}
```

To inspect specific gems instead, switch to `gem` mode and pass exact names:

```json
{
  "mode": "gem",
  "names": ["rails", "sinatra", "devise"],
  "includeReverseDependencies": true
}
```

### Input reference

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `mode` | string | `search` | `search` to query by keyword, or `gem` to look up exact gem names. |
| `query` | string | `json` | Keyword to search RubyGems.org (used in `search` mode). |
| `names` | array | `["rails","sinatra"]` | Exact gem names to look up (used in `gem` mode). |
| `maxResults` | integer | `10` | Maximum gems to collect. Free Apify plans are capped at 10 per run. |
| `includeReverseDependencies` | boolean | `false` | Paid add-on. Adds the reverse-dependency count plus a sample of up to 50 gems that depend on each result. |
| `withAiSummary` | boolean | `false` | Paid add-on. Adds an AI classification (what it does, category, comparable library, target user). |

### Output reference

| Field | Type | Description |
|-------|------|-------------|
| `name` | string | Gem name. |
| `description` | string | Gem description (`info`). |
| `latestVersion` | string | Latest published version. |
| `platform` | string | Gem platform (usually `ruby`). |
| `totalDownloads` | number | All-time download count. |
| `versionDownloads` | number | Downloads of the latest version. |
| `licenses` | array | License identifiers. |
| `authors` | string | Gem authors. |
| `homepageUrl` | string | Homepage link. |
| `sourceUrl` | string | Source code repository. |
| `projectUrl` | string | RubyGems.org gem page. |
| `documentationUrl` | string | Documentation link. |
| `changelogUrl` | string | Changelog link. |
| `bugTrackerUrl` | string | Issue tracker link. |
| `gemUri` | string | Direct `.gem` download URI. |
| `runtimeDependencies` | array | Runtime dependencies as `{name, requirements}`. |
| `runtimeDependencyCount` | number | Number of runtime dependencies. |
| `developmentDependencyCount` | number | Number of development dependencies. |
| `sha` | string | Gem checksum. |
| `yanked` | boolean | Whether the latest version is yanked. |
| `versionCreatedAt` | string | Publication date of the latest version. |
| `reverseDependencyCount` | number | Count of gems that depend on this one (add-on). |
| `reverseDependencies` | array | Sample of up to 50 dependent gem names (add-on). |
| `aiSummary` | object | AI classification of the gem (add-on). |
| `observedAt` | string | When the record was captured. |
| `error` | string | Error message for a failed lookup, otherwise `null`. |

### Use cases

- **Ruby dependency analysis:** map a gem's full runtime dependency tree and version requirements to plan upgrades and audit your Gemfile.
- **SCA and software supply chain:** use reverse dependencies to measure blast radius. See how many and which gems depend on a package before you patch, deprecate, or flag it.
- **Package popularity research:** rank gems by total and per-version downloads to pick the best-maintained option in a category.
- **Ruby dev tooling and dashboards:** feed clean, structured gem metadata into internal catalogs, dependency dashboards, and CI checks.
- **Competitive and ecosystem intelligence:** compare alternatives (for example web frameworks or auth libraries) side by side with an AI classification of what each gem does and who it targets.

### Run via API and CLI

Start a run with the Apify API and fetch the dataset when it finishes:

```bash
curl -X POST "https://api.apify.com/v2/acts/scrapers_lat~rubygems-packages-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "content-type: application/json" \
  -d '{"mode":"search","query":"authentication","maxResults":25}'
```

Or with the Apify CLI:

```bash
apify call scrapers_lat/rubygems-packages-scraper --input '{"mode":"gem","names":["rails"]}'
```

### Billing and limits

This actor is billed pay per event.

| Event | Price (USD) | When it is charged |
|-------|-------------|--------------------|
| `result` | $0.008 | Once per gem record written to the dataset. |
| `reverse_dependencies` | $0.008 | Once per gem, only when `includeReverseDependencies` is on and the dependent list is returned. |
| `ai_summary` | $0.012 | Once per gem, only when `withAiSummary` is on and the AI returns usable output. |

Notes:

- Add-ons are off by default and are disabled entirely for free Apify plans.
- Free Apify plans are capped at 10 results per run.
- Failed lookups (a gem that does not exist, or a transient source error) are written as an unbilled `error` row and never charged.
- The actor stops emitting and charging once your configured spend limit (`maxTotalChargeUsd`) is reached.

### FAQ and troubleshooting

**Do I need a RubyGems account or API key?** No. The actor reads the public RubyGems.org registry.

**Why is a gem's record an `error` row?** The gem name does not exist on RubyGems.org, or the registry was briefly unavailable. Error rows are never billed.

**How current are the downloads and versions?** They are read live from RubyGems.org at run time, so they reflect the registry at the moment of the run.

**Why are some fields `null`?** RubyGems does not always populate every link or field for every gem. Missing values are returned as `null` so the record shape stays consistent.

# Actor input Schema

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

Search RubyGems by keyword, or look up specific gems by name.

## `query` (type: `string`):

Keyword to search RubyGems.org (used in Search mode). For example 'json', 'authentication', 'rails middleware'.

## `names` (type: `array`):

Exact gem names to look up (used in Look up mode). For example \["rails", "sinatra", "devise"].

## `maxResults` (type: `integer`):

Maximum number of gems to collect. Free Apify plans are capped at 10 per run.

## `includeReverseDependencies` (type: `boolean`):

Off by default. When on, fetches which gems depend on each result (reverse-dependency count plus a sample of up to 50 dependents) for supply-chain / ecosystem impact analysis. Requires a paid Apify plan. Billed only when the list is returned.

## `withAiSummary` (type: `boolean`):

Off by default. When on, produces a short AI classification of each gem (what it does, category, comparable library, target user) from its name, description and dependencies. Requires a paid Apify plan. Billed only when usable output is produced.

## Actor input object example

```json
{
  "mode": "search",
  "query": "json",
  "names": [
    "rails",
    "sinatra"
  ],
  "maxResults": 10,
  "includeReverseDependencies": false,
  "withAiSummary": false
}
```

# Actor output Schema

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

No description

# 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 = {
    "query": "json",
    "names": [
        "rails",
        "sinatra"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapers_lat/rubygems-packages-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 = {
    "query": "json",
    "names": [
        "rails",
        "sinatra",
    ],
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("scrapers_lat/rubygems-packages-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 '{
  "query": "json",
  "names": [
    "rails",
    "sinatra"
  ],
  "maxResults": 10
}' |
apify call scrapers_lat/rubygems-packages-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapers_lat/rubygems-packages-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/zlWoJaA2lTdhep2FN/builds/FXJsjWY4cGSaKjc9X/openapi.json
