# Nasa Image Library Scraper (`bigibyte/nasa-image-library-scraper`) Actor

Search NASA's library for images, videos, and audio clips. Extract metadata, preview links, and original media files, then export your results directly as JSON, CSV, or Excel.

- **URL**: https://apify.com/bigibyte/nasa-image-library-scraper.md
- **Developed by:** [BigiByte](https://apify.com/bigibyte) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### NASA Image Library Scraper: Images, Videos, Audio

<p align="center">
  <img src="https://imgur.com/BGZCa2V.png" alt="NASA Image Library" style="max-width:100%; border-radius:14px; width:680px;" />
</p>

Search, extract, and structure media files quickly and easily. **BigiByte**'s NASA Image Library Scraper pulls rich metadata, preview links, and original media assets across images, videos, and audio into structured tabular datasets without any tedious manual searching or manual downloading.

***

### What Does This Tool Do?

Decades of space exploration stills, audio recordings, and video footage are available across vast collections. This scraper helps researchers, newsrooms, content creators, and educators quickly pull media sets into clean spreadsheets or JSON feeds.

#### Common Uses

- **Image & Media Research:** Gather high-resolution stills of missions, planets, or historical space exploration alongside item IDs and direct preview links.
- **Video & Audio Catalogs:** Filter media by video or audio types to pull speeches, launch audio clips, and mission footage in bulk.
- **Editorial & Publishing Desks:** Keep subject media lists updated on a regular schedule for quick export to CSV or Excel.
- **Classroom & Educational Collections:** Export curated, capped sets of media metadata for student projects and classroom presentations.
- **Asset Enrichment:** Automatically collect full original media file links along with basic metadata whenever high-resolution assets are needed.

***

### How to Set Up Your Run

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `mode` | String | `search` | Operation mode for fetching data. |
| `query` | String | `moon` | Keyword or search topic (e.g., "Mars", "Apollo", "Saturn"). |
| `mediaType` | String | `image` | Target media types: `image`, `video`, `audio`, or a comma-separated list. |
| `includeAssets` | Boolean | `false` | When enabled, fetches original high-resolution asset links. |
| `maxItems` | Integer | `100` | Maximum number of media rows to collect (capped at 1,000). |
| `timeoutSecs` | Integer | `300` | Maximum total run time in seconds. |
| `requestTimeoutSecs` | Integer | `30` | Time limit per individual request in seconds. |

#### Example Input Configuration

```json
{
    "mode": "search",
    "query": "moon",
    "mediaType": "image",
    "includeAssets": false,
    "maxItems": 100,
    "timeoutSecs": 300,
    "requestTimeoutSecs": 30
}

```

***

### Sample Extracted Output

Each dataset record provides clean metadata and ready-to-use media links:

```json
{
    "nasa_id": "PIA12235",
    "title": "Nearside of the Moon",
    "media_type": "image",
    "date_created": "2009-09-24T18:00:22Z",
    "center": "JPL",
    "href": "[https://images-assets.nasa.gov/image/PIA12235/collection.json](https://images-assets.nasa.gov/image/PIA12235/collection.json)",
    "data": [
        {
            "center": "JPL",
            "date_created": "2009-09-24T18:00:22Z",
            "description": "Nearside of the Moon",
            "description_508": "Nearside of the Moon",
            "keywords": ["Moon", "Chandrayaan-1"],
            "media_type": "image",
            "nasa_id": "PIA12235",
            "secondary_creator": "ISRO/NASA/JPL-Caltech/Brown Univ.",
            "title": "Nearside of the Moon"
        }
    ],
    "links": [
        {
            "href": "[https://images-assets.nasa.gov/image/PIA12235/PIA12235~medium.jpg](https://images-assets.nasa.gov/image/PIA12235/PIA12235~medium.jpg)",
            "render": "image",
            "width": 1280,
            "size": 114000,
            "height": 896
        }
    ],
    "scrapedAt": "2026-10-12T00:00:00+00:00"
}

```

#### Output Field Reference

| Field | Type | Description |
| --- | --- | --- |
| `nasa_id` | String | Unique identifier of the item for quick sorting and lookup. |
| `title` | String | Main title of the media item. |
| `media_type` | String | Type of media (`image`, `video`, or `audio`). |
| `date_created` | String | Official creation timestamp. |
| `center` | String | NASA center credited for the item. |
| `href` | String | Direct metadata link associated with the item hit. |
| `data` | Array | Extended metadata including description, keywords, and credits. |
| `links` | Array | Preview links, plus direct high-res file URLs when `includeAssets` is true. |
| `scrapedAt` | String | UTC timestamp recorded when the row was saved. |
| `error` | String | Explains any temporary item-level issue while keeping the rest of the run intact. |

***

### How it Works Under the Hood

- **Automatic Pagination:** Moves smoothly through search results up to 100 items per step until reaching your configured `maxItems`.
- **Deduplication:** Automatic checks remove repeated records based on unique item IDs.
- **Smart Retries:** Brief network hiccups or drops are handled automatically without stopping your task.
- **Flexible Downloads:** Grab your extracted datasets in JSON, CSV, or Excel formats anytime.

***

### Pricing & Usage Limits

- **Pay per compute usage:** Consumption is calculated based on standard platform compute units used during runtime.
- **Item Limit:** Runs default to collecting 100 items and are capped at a maximum of 1,000 items per run to keep runs fast and cost-effective.
- **Optimized Runs:** Keeping `includeAssets` set to `false` speeds up execution time and reduces compute usage when you only need basic metadata and previews.

***

### Related Tools & Custom Development

If you plan to map or join these rows, a geocoding pass or a quick CSV cleanup are the usual next steps. **BigiByte** also builds scrapers for other open-data portals when you need them as a separate job.

Need another portal's open data, a scheduled monitor, or a custom pipeline? **BigiByte** builds custom scrapers and APIs: <https://bigibyte.com>

***

### Frequently Asked Questions

**Can I export data directly to CSV or Excel?**

Yes! All extracted datasets can be downloaded directly in CSV, JSON, or Excel formats.

**How many media items can I extract in a single run?**

`maxItems` starts at 100 and can be adjusted up to 1,000 items per run.

**What happens if a network glitch occurs during a run?**

Built-in retries automatically re-attempt failed network steps. If an item cannot be reached after retries, an error entry is created for that specific record while the rest of the task finishes smoothly.

***

### Trademark Notice & Disclaimer

**Trademark Notice:** All referenced names, trademarks, and logos belong to their respective owners. Their use here is purely for identification purposes and does not imply any affiliation, sponsorship, or endorsement.

**Disclaimer:** This scraper is an independent solution developed by BigiByte. All data is gathered from publicly accessible sources. Users are expected to respect media usage guidelines, copyright notices, and platform policies.

***

### Is Web Scraping Legal?

This tool extracts publicly available media records and metadata. Extracting public web data is standard practice, but keep these helpful practices in mind:

- **Media Rights & Fair Use:** Educational and personal uses of public space images are widely accepted. Commercial reuse may require extra review if images include identifiable people, logos, or commercial branding.
- **Data Handling:** Always respect standard privacy best practices if handling metadata containing personal details.
- **Usage Guidelines:** Follow attribution standards and usage rules provided by content creators and hosts.
- **General Notice:** This section provides general educational context and does not constitute legal counsel.

Learn more by reading Apify's blog guide: [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

# Actor input Schema

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

Run mode. search queries the public NASA Image and Video Library and writes one dataset row per media item.

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

Text sent as the q parameter to the NASA search endpoint. A short subject such as moon, mars, or apollo works well.

## `mediaType` (type: `string`):

Filter passed as media_type. Use image, video, audio, or a comma-separated mix such as image,video.

## `includeAssets` (type: `boolean`):

When enabled, each search hit also calls the asset endpoint and appends original file URLs to the links array.

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

Maximum number of media rows to save in one run. Values above 1000 are clamped to 1000.

## `timeoutSecs` (type: `integer`):

Stop starting new requests after this many seconds. The platform run timeout still applies.

## `requestTimeoutSecs` (type: `integer`):

How long to wait for a single NASA response before treating that call as a timeout.

## `proxyConfiguration` (type: `object`):

Optional proxy for NASA requests. Leave Apify Proxy off. The public API does not require a proxy, and proxies must not be used to bypass stated limits.

## Actor input object example

```json
{
  "mode": "search",
  "query": "moon",
  "mediaType": "image",
  "includeAssets": false,
  "maxItems": 100,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Default dataset with one row per NASA media item.

# 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 = {
    "mode": "search",
    "query": "moon",
    "mediaType": "image",
    "maxItems": 100,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("bigibyte/nasa-image-library-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 = {
    "mode": "search",
    "query": "moon",
    "mediaType": "image",
    "maxItems": 100,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("bigibyte/nasa-image-library-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 '{
  "mode": "search",
  "query": "moon",
  "mediaType": "image",
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call bigibyte/nasa-image-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bigibyte/nasa-image-library-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/Dd23vhwxgClTHBVQA/builds/BxVebByAFWqMMQtSP/openapi.json
