# NASA Image and Video Library Scraper (`crawlerbros/nasa-images-scraper`) Actor

Search the NASA Image and Video Library - 140,000+ photos, videos, and audio clips from NASA missions, space exploration, astronauts, and Earth science. No API key required.

- **URL**: https://apify.com/crawlerbros/nasa-images-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Developer tools, Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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 a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## NASA Image and Video Library Scraper

Search and download metadata from the **NASA Image and Video Library** — the official public archive of NASA photos, videos, and audio recordings. Access over 140,000 media assets spanning the entire history of space exploration, from early rocket tests to the latest Mars rover missions.

**No API key required. No authentication. Completely free.**

### What You Can Scrape

- **Images**: High-resolution NASA photos of planets, spacecraft, astronauts, Earth, nebulae, galaxies, and more
- **Videos**: Mission footage, launch videos, space station activities, press briefings
- **Audio**: Historic mission audio, space sounds, recorded transmissions
- Search by keyword, filter by media type, year range, and NASA center
- Retrieve all download links for any specific NASA asset by its ID

### Input Configuration

| Field | Type | Description | Default |
|---|---|---|---|
| `mode` | Select | `searchMedia` to search, `getAsset` to look up a NASA ID | `searchMedia` |
| `query` | String | Search keywords (e.g. "Mars rover", "Apollo 11", "black hole") | `Mars` |
| `mediaType` | Select | Filter by `image`, `video`, `audio`, or leave empty for all types | `image` |
| `startYear` | Integer | Only include items from this year onward (e.g. `2020`) | — |
| `endYear` | Integer | Only include items up to this year (e.g. `2023`) | — |
| `nasaId` | String | NASA asset ID for `getAsset` mode (e.g. `PIA12345`) | — |
| `maxItems` | Integer | Maximum number of records to return | `50` |

#### Example Inputs

**Search for Mars rover images from 2020–2024:**
```json
{
  "mode": "searchMedia",
  "query": "Mars Perseverance rover",
  "mediaType": "image",
  "startYear": 2020,
  "endYear": 2024,
  "maxItems": 100
}
````

**Search for Apollo mission videos:**

```json
{
  "mode": "searchMedia",
  "query": "Apollo 11 moon landing",
  "mediaType": "video",
  "maxItems": 50
}
```

**Search all media types about the James Webb Space Telescope:**

```json
{
  "mode": "searchMedia",
  "query": "James Webb Space Telescope",
  "mediaType": "",
  "maxItems": 200
}
```

**Get all download links for a specific NASA asset:**

```json
{
  "mode": "getAsset",
  "nasaId": "PIA24959"
}
```

### Output Fields

#### searchMedia mode

| Field | Type | Description |
|---|---|---|
| `nasa_id` | String | Unique NASA asset identifier (e.g. `NHQ201906010007`) |
| `title` | String | Title of the media item |
| `description` | String | Full description of the item |
| `date_created` | String | Creation date in `YYYY-MM-DD` format |
| `media_type` | String | `image`, `video`, or `audio` |
| `center` | String | NASA center that produced the item (e.g. `JPL`, `GSFC`, `JSC`) |
| `keywords` | Array | Keywords/tags associated with the item |
| `photographer` | String | Photographer or creator credit |
| `secondary_creator` | String | Additional creator credit |
| `location` | String | Location where the item was created |
| `album` | Array | Album(s) the item belongs to |
| `preview_url` | String | URL of a preview/thumbnail image |
| `nasa_url` | String | NASA details page URL (e.g. `https://images.nasa.gov/details/PIA12345`) |
| `scrapedAt` | String | ISO timestamp when the record was scraped |

#### getAsset mode

| Field | Type | Description |
|---|---|---|
| `nasa_id` | String | The requested NASA asset ID |
| `asset_urls` | Array | All asset file URLs (images, videos, metadata) |
| `image_urls` | Array | Image file URLs only |
| `video_urls` | Array | Video file URLs only |
| `audio_urls` | Array | Audio file URLs only |
| `other_urls` | Array | Other file URLs (e.g. metadata JSON) |
| `preview_url` | String | Best image URL (prefers large, then original) |
| `nasa_url` | String | NASA details page URL |
| `scrapedAt` | String | ISO timestamp when the record was scraped |

#### Sample Output Record (searchMedia)

```json
{
  "nasa_id": "PIA24959",
  "title": "NASA's Perseverance Rover Captures Stunning Vista of Mars Canyon",
  "description": "NASA's Perseverance Mars rover captured this view using its Mastcam-Z camera system.",
  "date_created": "2021-06-17",
  "media_type": "image",
  "center": "JPL",
  "keywords": ["Mars", "Perseverance", "Mastcam-Z", "Jezero Crater"],
  "photographer": "NASA/JPL-Caltech/ASU",
  "preview_url": "https://images-assets.nasa.gov/image/PIA24959/PIA24959~thumb.jpg",
  "nasa_url": "https://images.nasa.gov/details/PIA24959",
  "scrapedAt": "2026-06-05T10:00:00+00:00"
}
```

### Popular Search Topics

- **Planets**: `Mars`, `Jupiter`, `Saturn rings`, `Earth from space`
- **Missions**: `Apollo 11`, `Artemis`, `Voyager`, `Hubble`, `James Webb`
- **Subjects**: `astronaut spacewalk`, `rocket launch`, `ISS`, `nebula`, `galaxy`
- **Events**: `solar eclipse`, `asteroid`, `comet`, `aurora`
- **Centers**: search combined with a center name like `JPL Mars` or `GSFC satellite`

### Data Source

This actor uses the **NASA Image and Video Library public API** (`images-api.nasa.gov`). The API is free, open to the public, and requires no API key or authentication. It is maintained by NASA and provides access to the full archive at [images.nasa.gov](https://images.nasa.gov).

API documentation: <https://images.nasa.gov/docs/images.nasa.gov_api_docs.pdf>

### Frequently Asked Questions

**Do I need an API key or NASA account?**
No. The NASA Image and Video Library API is completely public and requires no registration, API key, or authentication.

**How many items can I retrieve?**
You can retrieve up to 10,000 items per run. The NASA library contains over 140,000 assets. Use `query`, `mediaType`, and year filters to narrow results.

**Can I get the full-resolution image files?**
Use `getAsset` mode with a `nasaId` to retrieve all download links including the original high-resolution file. The `image_urls` field will contain all image renditions.

**What NASA centers are covered?**
All NASA centers including JPL (Jet Propulsion Laboratory), GSFC (Goddard Space Flight Center), JSC (Johnson Space Center), KSC (Kennedy Space Center), ARC (Ames Research Center), HQ (NASA Headquarters), and more.

**Are the images free to use?**
NASA images are generally in the public domain. However, always verify the specific usage rights for each image at the NASA details page (`nasa_url`).

**Why are some fields missing from results?**
Fields like `photographer`, `location`, `album`, and `secondary_creator` are only included when the NASA metadata contains them. The scraper never outputs empty or null fields.

**How are results paginated?**
The actor automatically paginates through all results using the NASA API's `page` parameter (up to 100 items per page) until your `maxItems` limit is reached or there are no more results.

**Can I search for audio recordings?**
Yes! Set `mediaType` to `audio` to find NASA audio recordings including mission transmissions, spacewalk audio, and historical recordings. Note that audio items typically don't have preview images.

# Actor input Schema

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

Select what to fetch: search for media by keyword/filters, or retrieve all asset links for a specific NASA ID.

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

Keyword or phrase to search for, e.g. "Mars rover", "Apollo 11", "black hole". Used in searchMedia mode.

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

Filter by media type. Leave empty to return all types.

## `startYear` (type: `integer`):

Only include items created from this year onward (inclusive). Example: 2020.

## `endYear` (type: `integer`):

Only include items created up to and including this year. Example: 2023.

## `nasaId` (type: `string`):

The NASA asset ID to retrieve links for, e.g. "PIA12345" or "NHQ201906010007". Required in getAsset mode.

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

Maximum number of records to return. Default 50, max 10000.

## Actor input object example

```json
{
  "mode": "searchMedia",
  "query": "Mars",
  "mediaType": "image",
  "maxItems": 50
}
```

# Actor output Schema

## `media` (type: `string`):

Dataset containing all scraped NASA media records.

# 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": "searchMedia",
    "query": "Mars",
    "mediaType": "image",
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/nasa-images-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": "searchMedia",
    "query": "Mars",
    "mediaType": "image",
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/nasa-images-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": "searchMedia",
  "query": "Mars",
  "mediaType": "image",
  "maxItems": 50
}' |
apify call crawlerbros/nasa-images-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlerbros/nasa-images-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "NASA Image and Video Library Scraper",
        "description": "Search the NASA Image and Video Library - 140,000+ photos, videos, and audio clips from NASA missions, space exploration, astronauts, and Earth science. No API key required.",
        "version": "1.0",
        "x-build-id": "pNdkTmPGJWwJcYBHp"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlerbros~nasa-images-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlerbros-nasa-images-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/crawlerbros~nasa-images-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlerbros-nasa-images-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/crawlerbros~nasa-images-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlerbros-nasa-images-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "searchMedia",
                            "getAsset"
                        ],
                        "type": "string",
                        "description": "Select what to fetch: search for media by keyword/filters, or retrieve all asset links for a specific NASA ID.",
                        "default": "searchMedia"
                    },
                    "query": {
                        "title": "Search query",
                        "type": "string",
                        "description": "Keyword or phrase to search for, e.g. \"Mars rover\", \"Apollo 11\", \"black hole\". Used in searchMedia mode.",
                        "default": "Mars"
                    },
                    "mediaType": {
                        "title": "Media type",
                        "enum": [
                            "image",
                            "video",
                            "audio",
                            ""
                        ],
                        "type": "string",
                        "description": "Filter by media type. Leave empty to return all types.",
                        "default": "image"
                    },
                    "startYear": {
                        "title": "Start year",
                        "minimum": 1900,
                        "maximum": 2100,
                        "type": "integer",
                        "description": "Only include items created from this year onward (inclusive). Example: 2020."
                    },
                    "endYear": {
                        "title": "End year",
                        "minimum": 1900,
                        "maximum": 2100,
                        "type": "integer",
                        "description": "Only include items created up to and including this year. Example: 2023."
                    },
                    "nasaId": {
                        "title": "NASA ID (getAsset mode)",
                        "type": "string",
                        "description": "The NASA asset ID to retrieve links for, e.g. \"PIA12345\" or \"NHQ201906010007\". Required in getAsset mode."
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of records to return. Default 50, max 10000.",
                        "default": 50
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
