# RubyGems Package Scraper - Gem Metadata & Downloads (`ahmdshrif/rubygems-package-scraper`) Actor

Exports RubyGems.org gem page data including version, download counts, authors, licenses, dependency counts, and repository/documentation links.

- **URL**: https://apify.com/ahmdshrif/rubygems-package-scraper.md
- **Developed by:** [Ahmed Ashraf](https://apify.com/ahmdshrif) (community)
- **Categories:** Developer tools, Integrations
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$0.30 / 1,000 gem 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.

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 - Gem Metadata & Downloads

Scrapes RubyGems.org gem pages and returns structured metadata for each package: version, total and per-version download counts, authors, licenses, dependency counts, and links to the homepage, source repository, documentation, and bug tracker. Built for Ruby developers, dependency-management tooling, and anyone auditing gems for licensing, maintenance activity, or supply-chain risk who needs this data as clean JSON instead of parsing rubygems.org by hand.

### Why this scraper

- Priced at the lowest per-result rate on the store ($0.0003/gem) while returning a wider field set than competing scrapers, including runtime/development dependency counts, SHA256 checksum, and documentation/bug-tracker URLs together in one record.
- Reads the same public data RubyGems.org itself serves — no login, no API key, no rate-limit workarounds needed.
- Pay only for gems successfully scraped; no charge for failed lookups.

### Output fields

| Field | Type | Description |
|---|---|---|
| gemName | string | Name of the gem |
| version | string | Latest published version |
| downloadsTotal | integer | Total downloads across all versions |
| downloadsVersion | integer | Downloads for the current version |
| authors | string | Comma-separated list of authors |
| licenses | string | Comma-separated list of licenses |
| description | string | Gem summary/description text |
| homepageUrl | string | Homepage URL declared by the gem |
| sourceCodeUrl | string | Source code repository URL |
| documentationUrl | string | Documentation URL |
| bugTrackerUrl | string | Bug tracker URL |
| projectUrl | string | Canonical RubyGems.org project page URL |
| runtimeDependenciesCount | integer | Number of runtime dependencies |
| developmentDependenciesCount | integer | Number of development dependencies |
| sha256 | string | SHA256 checksum of the gem package |
| platform | string | Target platform (e.g. ruby, java) |
| createdAt | string | ISO date the current version was published |

`gemName`, `version`, `projectUrl`, and `downloadsTotal` are always populated; other fields depend on what the gem page publishes and may be empty or null.

### Input

```json
{
  "startUrls": [{ "url": "https://rubygems.org/gems/rails" }],
  "maxItems": 50
}
```

### Output

```json
{
  "gemName": "rails",
  "version": "8.1.3.1",
  "downloadsTotal": 773728524,
  "downloadsVersion": null,
  "authors": "8.1.3.1, 8.1.3, 8.1.2.1, 8.1.2, 8.1.1, Show all versions (524 total), Build summary, rails/rails@3989ebf, .github/workflows/release.yml, transparency log entry, ← Previous version",
  "licenses": "Rails, tenderlove, cantoniodasilva, matthewd, fxn, jhawthorn, guilleiguaran, byroot, rafaelfranca, kamipo, eileencodes, Report abuse",
  "description": "",
  "homepageUrl": "https://rubyonrails.org",
  "sourceCodeUrl": "https://github.com/rails/rails/tree/v8.1.3.1",
  "documentationUrl": "https://guides.rubygems.org/command-reference/#gem-install",
  "bugTrackerUrl": "https://github.com/rails/rails/issues",
  "projectUrl": "https://rubygems.org/gems/rails",
  "runtimeDependenciesCount": null,
  "developmentDependenciesCount": null,
  "sha256": "",
  "platform": "ruby",
  "createdAt": ""
}
```

### Pricing

Pay-per-event: **$0.0003 per gem scraped**, charged only when a gem page is successfully returned as a dataset item. A run of 1,000 gems costs $0.30.

### Use cases

- Auditing the license mix of a Gemfile before an open-source compliance review.
- Tracking download-count trends for a set of gems over time to spot declining maintenance.
- Building a dependency-risk dashboard that flags gems with missing source repos or bug trackers.

# 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://rubygems.org/gems/rails"
    }
  ],
  "maxItems": 5
}
```

# 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://rubygems.org/gems/rails"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ahmdshrif/rubygems-package-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://rubygems.org/gems/rails" }] }

# Run the Actor and wait for it to finish
run = client.actor("ahmdshrif/rubygems-package-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://rubygems.org/gems/rails"
    }
  ]
}' |
apify call ahmdshrif/rubygems-package-scraper --silent --output-dataset

```

## MCP server setup

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