# Library of Congress Scraper (`parseforge/loc-gov-library-of-congress-scraper`) Actor

Export records from the US Library of Congress catalog of 170M+ items. Search books, audio, film, maps, manuscripts, newspapers, photos, sheet music, and web archives. Pull titles, contributors, dates, subjects, languages, image URLs, and direct catalog links.

- **URL**: https://apify.com/parseforge/loc-gov-library-of-congress-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $14.00 / 1,000 result items

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

![ParseForge Banner](https://github.com/ParseForge/apify-assets/blob/ad35ccc13ddd068b9d6cba33f323962e39aed5b2/banner.jpg?raw=true)

## 🏛️ Library of Congress Scraper

> 🚀 **Export the world's largest cultural archive in seconds.** Search **170,000,000+ digitized items** at the US Library of Congress across **11 format types**, including books, audio, film, maps, manuscripts, newspapers, photos, sheet music, and web archives. No login, no manual harvesting.

> 🕒 **Last updated:** 2026-05-23 · **📊 18 fields** per record · **🏛️ 170M+ items** · **🎞️ 11 formats** · **🌍 multilingual catalog**

The **Library of Congress Scraper** queries the LOC digital catalog and returns **18 structured fields per record**, including title, contributors, date, subjects, languages, format, mediums, rights, repository info, and direct links to resource files and image derivatives. The LOC has been digitizing its holdings since the 1990s and exposes the world's most comprehensive open cultural catalog.

The catalog spans **books and printed material, audio recordings, films, maps, manuscripts, historical newspapers, photographs, sheet music, notated music, web archives, and curated collections**. This Actor returns the data as CSV, Excel, JSON, or XML in under five minutes, with year-range, language, and collection filters applied server-side.

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| Historians, archivists, journalists, educators, documentary producers, genealogists, digital humanities researchers, museum curators | Source primary documents, build classroom packs, enrich research databases, locate rights-cleared media, map historical newspapers, source public-domain images |

---

### 📋 What the Library of Congress Scraper does

Five archival workflows in a single run:

- 📚 **Format-scoped search.** Pick one of 11 LOC formats (books, audio, film, maps, manuscripts, newspapers, photos, sheet music, web archives, notated music, collections).
- 🔎 **Keyword search.** Free-text search across the chosen format.
- 🌐 **Language filter.** Restrict to a single language slug (e.g. english, spanish, french, chinese, arabic).
- 📅 **Date range.** Earliest and latest year inclusive, for time-bounded research.
- 🗂️ **Collection filter.** Restrict to a curated LOC collection slug (e.g. `wpa-life-histories`, `civil-war-maps`).

Each record includes the LOC item ID, title, description, contributor list, date, subject tags, language list, format and medium, parent collection, repository, rights statement, every resource URL (manifests, audio, video, IIIF images), and a primary image thumbnail.

> 💡 **Why it matters:** the LOC catalog is the foundational reference for American cultural and political history. Building your own harvester means navigating multiple catalog endpoints, parsing nested metadata, and chasing pagination across millions of records. This Actor turns the entire catalog into a download.

---

### 🎬 Full Demo

_🚧 Coming soon: a 3-minute walkthrough showing how to go from sign-up to a downloaded archive dataset._

---

### ⚙️ Input

<table>
<thead>
<tr><th>Input</th><th>Type</th><th>Default</th><th>Behavior</th></tr>
</thead>
<tbody>
<tr><td>maxItems</td><td>integer</td><td>10</td><td>Records to return. Free plan caps at 10, paid plan at 1,000,000.</td></tr>
<tr><td>format</td><td>string</td><td>"books"</td><td>One of 11 LOC format collections.</td></tr>
<tr><td>searchQuery</td><td>string</td><td>"jazz"</td><td>Free-text keyword search.</td></tr>
<tr><td>language</td><td>string</td><td>""</td><td>Language slug (english, spanish, french, german, chinese, arabic, ...).</td></tr>
<tr><td>dateStart, dateEnd</td><td>integer</td><td>null</td><td>Earliest and latest year, inclusive.</td></tr>
<tr><td>collection</td><td>string</td><td>""</td><td>LOC collection slug, e.g. wpa-life-histories.</td></tr>
</tbody>
</table>

**Example: 100 jazz-related sheet music items from 1920-1940.**

```json
{
    "maxItems": 100,
    "format": "sheet-music",
    "searchQuery": "jazz",
    "dateStart": 1920,
    "dateEnd": 1940
}
````

**Example: 200 Civil War era photographs.**

```json
{
    "maxItems": 200,
    "format": "photos",
    "searchQuery": "civil war",
    "dateStart": 1861,
    "dateEnd": 1865
}
```

> ⚠️ **Good to Know:** the LOC catalog spans materials from antiquity to the present. Rights statements vary by item, so always check the `rights` field before reuse. Many photos, maps, and historical newspapers are public domain, while audio and film may carry contributor or estate restrictions.

***

### 📊 Output

Each record contains **18 fields**. Download the dataset as CSV, Excel, JSON, or XML.

#### 🧾 Schema

| Field | Type | Example |
|---|---|---|
| 🖼️ `imageUrl` | string | null | `"https://tile.loc.gov/image-services/iiif/.../full/pct:12.5/0/default.jpg"` |
| 🆔 `itemId` | string | `"http://www.loc.gov/item/2017660631/"` |
| 📚 `title` | string | `"Take the 'A' train"` |
| 📝 `description` | array | `["Sheet music with cover art..."]` |
| 👥 `contributors` | array | `["Strayhorn, Billy", "Ellington, Duke"]` |
| 📅 `date` | string | null | `"1941"` |
| 🏷️ `subjects` | array | `["Jazz", "Big band music"]` |
| 🌐 `languages` | array | `["english"]` |
| 🎞️ `format` | array | `["sheet music"]` |
| 🎨 `mediums` | array | `["1 score (3 pages)"]` |
| 📚 `collections` | array | `["Music for the Nation"]` |
| 🗂️ `partof` | array | `[{"title":"American Song Sheets", "url":"..."}]` |
| 🏛️ `repositories` | array | `["Library of Congress, Music Division"]` |
| ⚖️ `rights` | string | null | `"Rights Advisory: Public domain"` |
| 📦 `resourceUrls` | array | `["https://www.loc.gov/resource/.../mp3"]` |
| 🖼️ `imageUrls` | array | `["https://tile.loc.gov/image-services/..."]` |
| 🔗 `url` | string | `"https://www.loc.gov/item/2017660631/"` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-23T00:00:00.000Z"` |

#### 📦 Sample records

<details>
<summary><strong>🎼 Sheet music: Take the 'A' Train (1941)</strong></summary>

```json
{
    "imageUrl": "https://tile.loc.gov/image-services/iiif/service:music:cooper:cooper-100051600:cooper-100051600.0001/full/pct:12.5/0/default.jpg",
    "itemId": "http://www.loc.gov/item/2017660631/",
    "title": "Take the 'A' train",
    "description": ["Sheet music with cover art featuring Duke Ellington."],
    "contributors": ["Strayhorn, Billy", "Ellington, Duke"],
    "date": "1941",
    "subjects": ["Jazz", "Big band music", "Popular music"],
    "languages": ["english"],
    "format": ["sheet music"],
    "mediums": ["1 score (3 pages)"],
    "collections": ["Music for the Nation"],
    "repositories": ["Library of Congress, Music Division"],
    "rights": "Public domain in the United States.",
    "resourceUrls": ["https://www.loc.gov/resource/musmisc.2017660631.0/"],
    "imageUrls": ["https://tile.loc.gov/image-services/iiif/service:music:cooper:cooper-100051600/full/pct:25/0/default.jpg"],
    "url": "https://www.loc.gov/item/2017660631/",
    "scrapedAt": "2026-05-23T00:00:00.000Z"
}
```

</details>

<details>
<summary><strong>📰 Historical newspaper: Chronicling America</strong></summary>

```json
{
    "imageUrl": "https://tile.loc.gov/image-services/iiif/service:ndnp:dlc:batch_dlc_jamaica_ver01:.../full/pct:12.5/0/default.jpg",
    "itemId": "http://www.loc.gov/item/sn83030193/1900-01-01/ed-1/",
    "title": "The Sun. [volume] (New York, N.Y.) 1833-1916, January 01, 1900, Page 1",
    "contributors": ["The Sun (newspaper)"],
    "date": "1900-01-01",
    "subjects": ["New York (N.Y.)--Newspapers"],
    "languages": ["english"],
    "format": ["newspaper"],
    "collections": ["Chronicling America"],
    "repositories": ["Library of Congress"],
    "rights": "No known restrictions.",
    "imageUrls": ["https://tile.loc.gov/image-services/iiif/service:ndnp:dlc:batch_dlc_jamaica_ver01:data:sn83030193:00175037938:1900010101:0011.jp2/full/pct:25/0/default.jpg"],
    "url": "https://www.loc.gov/item/sn83030193/1900-01-01/ed-1/",
    "scrapedAt": "2026-05-23T00:00:00.000Z"
}
```

</details>

<details>
<summary><strong>📸 Civil War photograph</strong></summary>

```json
{
    "imageUrl": "https://tile.loc.gov/image-services/iiif/service:pnp:cwpb:00000:00100:00150v/full/pct:25/0/default.jpg",
    "itemId": "http://www.loc.gov/pictures/item/cwp2003000150/PP/",
    "title": "Headquarters Army of the Potomac",
    "contributors": ["Brady, Mathew B., 1823-1896"],
    "date": "1862",
    "subjects": ["United States--History--Civil War, 1861-1865"],
    "format": ["photograph"],
    "mediums": ["1 photographic print"],
    "collections": ["Civil War Photographs"],
    "repositories": ["Library of Congress, Prints and Photographs Division"],
    "rights": "No known restrictions on publication.",
    "imageUrls": ["https://tile.loc.gov/image-services/iiif/service:pnp:cwpb:00000:00100:00150v/full/pct:50/0/default.jpg"],
    "url": "https://www.loc.gov/pictures/item/cwp2003000150/PP/",
    "scrapedAt": "2026-05-23T00:00:00.000Z"
}
```

</details>

***

### ✨ Why choose this Actor

| | Capability |
|---|---|
| 🏛️ | **170M+ item catalog.** Books, audio, film, maps, manuscripts, newspapers, photos, sheet music, web archives. |
| 🎯 | **Multi-dimensional filtering.** Format, query, language, year range, and collection combine in a single run. |
| 🖼️ | **Direct image URLs.** Thumbnail plus full image derivatives via the IIIF tile service. |
| ⚖️ | **Rights metadata included.** Every record carries its rights statement for clean reuse. |
| ⚡ | **Fast.** 10 items in under 5 seconds, 10,000 records in under 10 minutes. |
| 🔁 | **Always fresh.** Every run hits the live LOC catalog. |
| 🚫 | **No authentication.** Public catalog, no key required. |

> 📊 The Library of Congress is the world's largest open cultural archive. Structured access to it powers documentaries, classrooms, podcasts, and serious historical research.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Filters | Setup |
|---|---|---|---|---|---|
| **⭐ Library of Congress Scraper** *(this Actor)* | $5 free credit, then pay-per-use | **170M+** items | **Live per run** | format, query, language, date, collection | ⚡ 2 min |
| Commercial archive aggregators | $200+/month | Curated slice | Quarterly | Limited | 🐢 Days |
| Custom OAI-PMH harvester | Free engineering | Full | Cron driven | Hand built | ⏳ Weeks |
| One-off catalog browsing | Free | Per-search only | Live | UI only | 🕒 Manual |

Pick this Actor when you want clean, filterable rows ready for a database, with zero parser maintenance.

***

### 🚀 How to use

1. 📝 **Sign up.** [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=vmoqkp) (takes 2 minutes).
2. 🌐 **Open the Actor.** Go to the Library of Congress Scraper page on the Apify Store.
3. 🎯 **Set input.** Pick a format, add a keyword, set optional language, year range, or collection.
4. 🚀 **Run it.** Click **Start** and let the Actor collect catalog records.
5. 📥 **Download.** Grab your results from the **Dataset** tab as CSV, Excel, JSON, or XML.

> ⏱️ Total time from signup to downloaded dataset: **3-5 minutes.** No coding required.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%" valign="top">

#### 📺 Documentary & Media Production

- Locate rights-cleared archival imagery for films
- Source historical newspaper clippings for B-roll graphics
- Build music libraries from public-domain sheet music
- Surface manuscript pages for on-screen quotation

</td>
<td width="50%" valign="top">

#### 🎓 Education & EdTech

- Build classroom packs around primary sources
- Generate AP-history flashcards with original documents
- Curate language-arts excerpts from public-domain books
- Stock virtual museum exhibits for K-12 platforms

</td>
</tr>
<tr>
<td width="50%" valign="top">

#### 📰 Journalism & Fact-Checking

- Verify historical claims against primary sources
- Pull contemporary newspaper coverage for explainers
- Source archival quotes for long-form features
- Build searchable backgrounders on historic events

</td>
<td width="50%" valign="top">

#### 🌳 Genealogy & Local History

- Surface ancestor mentions in historic newspapers
- Map regional photo collections by place
- Compile family history with WPA life history excerpts
- Build town-history sites from local archive items

</td>
</tr>
</table>

***

### 🔌 Automating Library of Congress Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

- 🟢 **Node.js.** Install the `apify-client` NPM package.
- 🐍 **Python.** Use the `apify-client` PyPI package.
- 📚 See the [Apify API documentation](https://docs.apify.com/api/v2) for full details.

The [Apify Schedules feature](https://docs.apify.com/platform/schedules) lets you trigger this Actor on any cron interval. Weekly refreshes keep a downstream archive database in sync with new digitizations.

***

### 🌟 Beyond business use cases

Cultural archives power more than commercial workflows. The same structured records support research, education, civic projects, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Digital humanities theses and projects
- Quantitative history with newspaper text mining
- Archival reproducibility with cited dataset pulls
- Cross-collection comparative studies

</td>
<td width="50%">

#### 🎨 Personal and creative

- Public-domain artwork for design portfolios
- Historical-fiction research bibles
- Hobbyist genealogy and local-history projects
- Creative-commons mood boards and Pinterest archives

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- Civic history exhibits for libraries and town halls
- Investigative journalism on historic events
- Free educational materials for underserved schools
- Heritage projects for immigrant and minority communities

</td>
<td width="50%">

#### 🧪 Experimentation

- Train OCR and handwriting recognition models
- Build LLM training corpora from public-domain text
- Prototype IIIF-based viewer apps
- Test image-classification models on historical media

</td>
</tr>
</table>

***

### 🤖 Ask an AI assistant about this scraper

Open a ready-to-send prompt about this ParseForge actor in the AI of your choice:

- 💬 [**ChatGPT**](https://chat.openai.com/?q=How%20do%20I%20use%20the%20Library%20of%20Congress%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🧠 [**Claude**](https://claude.ai/new?q=How%20do%20I%20use%20the%20Library%20of%20Congress%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🔍 [**Perplexity**](https://perplexity.ai/search?q=How%20do%20I%20use%20the%20Library%20of%20Congress%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🅒 [**Copilot**](https://copilot.microsoft.com/?q=How%20do%20I%20use%20the%20Library%20of%20Congress%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)

***

### ❓ Frequently Asked Questions

#### 🧩 How does it work?

Pick one of 11 LOC formats, add a keyword and optional filters (language, year range, collection), then click Start. The Actor returns structured rows with titles, contributors, dates, subjects, rights, and direct image and resource links.

#### 📏 How complete is the metadata?

LOC metadata is curated by professional catalogers and is among the most complete in the world. Some fields like `rights` or `description` can be empty for niche items, which reflects the source record rather than a scraper gap.

#### 🔁 How often is the catalog refreshed?

The LOC adds and updates records continuously. Every Actor run hits the live catalog, so new digitizations and edits appear in your dataset right away.

#### 🎞️ Which formats are supported?

Books and printed material, audio recordings, film and video, maps, manuscripts, newspapers (Chronicling America), photos and prints, sheet music, notated music, web archives, and curated collections.

#### 🖼️ Are image URLs returned?

Yes. Most visual items expose a primary thumbnail in `imageUrl` plus higher-resolution derivatives in `imageUrls` via the LOC IIIF tile service.

#### ⏰ Can I schedule regular runs?

Yes. Use Apify Schedules to trigger this Actor on any cron interval (daily, weekly, monthly).

#### ⚖️ Is this data legal to use?

LOC catalog metadata is public. Item rights vary, so check the `rights` field before reusing media. Many photographs, historical newspapers, and pre-1929 materials are in the public domain in the United States.

#### 💼 Can I use this data commercially?

Catalog metadata, yes. Individual media files depend on the rights statement returned per item. Always honor the `rights` field.

#### 💳 Do I need a paid Apify plan to use this Actor?

No. The free Apify plan covers testing and small runs (10 records per run). A paid plan unlocks the higher cap, scheduling, and concurrency.

#### 🔁 What happens if a run fails or gets interrupted?

Apify retries transient errors automatically. If a run still fails, inspect the log, fix the input, and restart. Partial datasets are preserved.

#### 🆘 What if I need help?

Our support team is here. Use the Apify platform messaging or the Tally form linked below.

***

### 🔌 Integrate with any app

Library of Congress Scraper connects to any cloud service via [Apify integrations](https://apify.com/integrations):

- [**Make**](https://docs.apify.com/platform/integrations/make) - Automate multi-step workflows
- [**Zapier**](https://docs.apify.com/platform/integrations/zapier) - Connect with 5,000+ apps
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - Get run notifications in your channels
- [**Airbyte**](https://docs.apify.com/platform/integrations/airbyte) - Pipe archive data into your warehouse
- [**GitHub**](https://docs.apify.com/platform/integrations/github) - Trigger runs from commits and releases
- [**Google Drive**](https://docs.apify.com/platform/integrations/drive) - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes. Push fresh records into your archive database or alert your editorial team in Slack.

***

### 🔗 Recommended Actors

- [**📚 LibriVox Audiobooks Scraper**](https://apify.com/parseforge/librivox-audiobooks-scraper) - Public-domain audiobooks with reader credits
- [**🗣️ Tatoeba Sentence Corpus Scraper**](https://apify.com/parseforge/tatoeba-sentence-corpus-scraper) - 12M+ multilingual example sentences
- [**🎨 Met Museum Scraper**](https://apify.com/parseforge/met-museum-scraper) - Open-access artworks from The Met
- [**📰 ArXiv Scraper**](https://apify.com/parseforge/arxiv-scraper) - Academic preprints with metadata
- [**📖 Figshare Scraper**](https://apify.com/parseforge/figshare-scraper) - Open research datasets and figures

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more reference-data scrapers.

***

**🆘 Need Help?** [**Open our contact form**](https://tally.so/r/BzdKgA) to request a new scraper, propose a custom data project, or report an issue.

***

> **⚠️ Disclaimer:** this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by the US Library of Congress. All trademarks mentioned are the property of their respective owners. Only publicly available catalog data is collected. Honor each item's individual rights statement.

# Actor input Schema

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

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## `format` (type: `string`):

Which Library of Congress format collection to search.

## `searchQuery` (type: `string`):

Free-text keyword search across the chosen format.

## `language` (type: `string`):

Restrict to a single language slug (e.g. english, spanish, french, german, chinese, arabic).

## `dateStart` (type: `integer`):

Earliest year (inclusive).

## `dateEnd` (type: `integer`):

Latest year (inclusive).

## `collection` (type: `string`):

Restrict to a specific Library of Congress collection slug (e.g. wpa-life-histories, civil-war-maps).

## Actor input object example

```json
{
  "maxItems": 10,
  "format": "books",
  "searchQuery": "jazz"
}
```

# Actor output Schema

## `overview` (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 = {
    "maxItems": 10,
    "format": "books",
    "searchQuery": "jazz"
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/loc-gov-library-of-congress-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 = {
    "maxItems": 10,
    "format": "books",
    "searchQuery": "jazz",
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/loc-gov-library-of-congress-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 '{
  "maxItems": 10,
  "format": "books",
  "searchQuery": "jazz"
}' |
apify call parseforge/loc-gov-library-of-congress-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/loc-gov-library-of-congress-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Library of Congress Scraper",
        "description": "Export records from the US Library of Congress catalog of 170M+ items. Search books, audio, film, maps, manuscripts, newspapers, photos, sheet music, and web archives. Pull titles, contributors, dates, subjects, languages, image URLs, and direct catalog links.",
        "version": "1.0",
        "x-build-id": "QMauDidkHYiZ5GPiR"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~loc-gov-library-of-congress-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-loc-gov-library-of-congress-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/parseforge~loc-gov-library-of-congress-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-loc-gov-library-of-congress-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/parseforge~loc-gov-library-of-congress-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-loc-gov-library-of-congress-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",
                "properties": {
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000"
                    },
                    "format": {
                        "title": "Format",
                        "enum": [
                            "books",
                            "audio",
                            "film-and-videos",
                            "maps",
                            "manuscripts",
                            "newspapers",
                            "photos",
                            "sheet-music",
                            "web-archives",
                            "notated-music",
                            "collections"
                        ],
                        "type": "string",
                        "description": "Which Library of Congress format collection to search."
                    },
                    "searchQuery": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Free-text keyword search across the chosen format."
                    },
                    "language": {
                        "title": "Language",
                        "type": "string",
                        "description": "Restrict to a single language slug (e.g. english, spanish, french, german, chinese, arabic)."
                    },
                    "dateStart": {
                        "title": "Date Start",
                        "type": "integer",
                        "description": "Earliest year (inclusive)."
                    },
                    "dateEnd": {
                        "title": "Date End",
                        "type": "integer",
                        "description": "Latest year (inclusive)."
                    },
                    "collection": {
                        "title": "Collection",
                        "type": "string",
                        "description": "Restrict to a specific Library of Congress collection slug (e.g. wpa-life-histories, civil-war-maps)."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
