# BrainyQuote Scraper (`shahidirfan/brainyquote-scraper`) Actor

Easily extract quotes, authors, and topics from BrainyQuote. This lightweight actor is designed for fast and structured data collection. For seamless performance and to avoid potential blocking, using residential proxies is highly recommended.

- **URL**: https://apify.com/shahidirfan/brainyquote-scraper.md
- **Developed by:** [Shahid Irfan](https://apify.com/shahidirfan) (community)
- **Categories:** Developer tools, Automation, Other
- **Features:** Limited permissions
- **Stats:** 14 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

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

### What does BrainyQuote Quotes Scraper do?

BrainyQuote Quotes Scraper collects quote text, authors, quote links, topics, tags, and page details from BrainyQuote. Choose one input mode per run: a topic, an author, or one or more BrainyQuote URLs. Results are saved to an Apify dataset for research, content planning, and personal quote collections.

BrainyQuote is protected by Cloudflare and may deny requests. Runs use a full stealth browser so pages render normally. A proxy is optional and is empty by default; adding a residential proxy improves reliability when requests are challenged. Proxy configuration does not guarantee access, and a blocked run can finish with no quote records.

### Why use BrainyQuote Quotes Scraper?

- **Build a quote dataset** - Collect quotes and attribution in a structured format instead of copying pages by hand.
- **Focus the collection** - Select a topic, an author, or specific BrainyQuote pages for each run.
- **Continue across pages** - Set a page limit and maximum item count for a topic or author search.
- **Use the results in other tools** - Download the dataset or connect it to an Apify integration or API workflow.

### What data can you extract from BrainyQuote?

| Field | Type | Description |
|-------|------|-------------|
| `quote` | String | Quote text. Records without quote text are omitted. |
| `author` | String or null | Quote author when shown on the page. |
| `author_url` | String or null | BrainyQuote author page URL when available. |
| `quote_url` | String or null | Link to the quote page when available. |
| `topic` | String or null | Selected topic; may be empty for author or custom URL runs. |
| `tags` | Array | Related topic tags found on the page. |
| `page` | Integer or null | Page number associated with the result. |
| `position` | Integer or null | Quote position on its page. |
| `language` | String | Language code, currently `en`. |
| `source` | String or null | Collection source recorded for the result. |
| `telemetry` | Object or null | Available region, country, consent, and user-agent metadata. |
| `scraped_at` | String | ISO timestamp for when the record was collected. |

### How to use BrainyQuote Quotes Scraper

1. Choose a topic, enter an author, or add one or more BrainyQuote URLs. Use only one mode per run.
2. For a topic or author, set `maxPages` to control how many pages to visit.
3. Set `maxItems` to cap the number of quotes saved.
4. Run the Actor and review the dataset.
5. Export the dataset or connect it to another workflow.

Input mode precedence is `startUrls`, then `author`, then `topic`. If multiple modes are provided, only the first applicable mode is used. When no mode is supplied, the Actor uses the `motivational` topic.

### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `startUrls` | Array | No | None | BrainyQuote URLs. When non-empty, these are used instead of `author` or `topic`. |
| `topic` | String | No | `motivational` in topic mode | Topic slug such as `success` or `happiness`, with or without the `-quotes` suffix. |
| `author` | String | No | None | Author name. Used only when `startUrls` is empty. |
| `maxPages` | Integer | No | `3` | Maximum pages to visit for topic or author mode. |
| `maxItems` | Integer | No | `20` | Maximum number of quotes to save across the run. |
| `proxyConfiguration` | Object | No | None | Optional. BrainyQuote is Cloudflare-protected; a residential proxy improves reliability, and any proxy you trust works. Leave it empty to run without a proxy. Local runs skip Apify-managed proxies unless custom proxy URLs are supplied. Access is not guaranteed. |

### Usage Examples

#### Collect quotes from a topic

This example collects up to 20 quotes from the first three pages of the motivational topic.

```json
{
  "topic": "motivational",
  "maxPages": 3,
  "maxItems": 20
}
```

#### Collect quotes by author

This example searches BrainyQuote's author pages for Albert Einstein quotes.

```json
{
  "author": "Albert Einstein",
  "maxPages": 3,
  "maxItems": 50
}
```

#### Collect quotes from specific pages

Use custom BrainyQuote URLs to select the pages for a run. The URLs take precedence over topic and author inputs.

```json
{
  "startUrls": [
    {
      "url": "https://www.brainyquote.com/topics/success-quotes"
    },
    {
      "url": "https://www.brainyquote.com/topics/happiness-quotes"
    }
  ],
  "maxItems": 40
}
```

### Sample Output

A dataset item has the following shape. Optional values can be `null`, and `tags` can be empty when no tags are present on the page.

```json
{
  "quote": "When you reach the end of your rope, tie a knot in it and hang on.",
  "author": "Franklin D. Roosevelt",
  "author_url": "https://www.brainyquote.com/authors/franklin-d-roosevelt-quotes",
  "quote_url": "https://www.brainyquote.com/quotes/franklin_d_roosevelt_101840?src=t_motivational",
  "topic": "motivational",
  "tags": [],
  "page": 1,
  "position": 1,
  "language": "en",
  "source": "browser",
  "telemetry": null,
  "scraped_at": "2026-07-18T10:47:07.472Z"
}
```

### Tips for best results

- Start with a small `maxItems` value to check whether the selected pages are accessible.
- Use the exact public BrainyQuote page URLs for custom URL runs.
- Topic and author runs use `maxPages`; custom URL runs visit each supplied URL once.
- A 403 or an unresolved Cloudflare check means BrainyQuote denied the request. Use a residential or Apify UNBLOCKER proxy for this target; datacenter proxies are frequently challenged.
- Empty tags or optional attribution fields can reflect missing source-page information.

### Integrations and exports

Apify datasets can be downloaded in JSON, CSV, Excel, XML, and other supported formats. Use Apify's API, webhooks, Google Sheets, Make, or Zapier integrations to move quote data into your own workflow.

### Frequently Asked Questions

#### Why did my run return no quotes?

BrainyQuote may return HTTP 403 or an unresolved Cloudflare check, or a page without quote cards. The Actor cannot guarantee that a request will be allowed; use a residential or Apify UNBLOCKER proxy, check the run log, and try a smaller run before scheduling more pages.

#### Can I combine a topic, author, and custom URLs?

No. The Actor uses one search mode per run. Custom URLs take precedence, followed by author search, then topic search.

#### How many pages can I collect?

Topic and author runs visit up to `maxPages` pages and stop when `maxItems` is reached. Custom URL runs process the URLs supplied in `startUrls`.

#### Why are some fields empty?

BrainyQuote does not show every field for every quote. Missing author links, tags, or metadata are represented as empty or `null` values where applicable.

#### Can I export the results to CSV or Excel?

Yes. Apify datasets support CSV, Excel, JSON, XML, and other export formats.

#### Is it legal to collect BrainyQuote data?

You are responsible for complying with BrainyQuote's terms, applicable laws, and privacy requirements when collecting and using data.

### Support

For issues or feature requests, use the Issues tab on the Actor page or contact the developer through Apify.

### Legal Notice

This Actor is intended for responsible collection of publicly available quote data. Users are responsible for checking the source website's terms and complying with applicable laws.

# Actor input Schema

## `startUrls` (type: `array`):

Optional BrainyQuote URLs. When provided, these are used instead of topic or author search.

## `topic` (type: `string`):

Topic slug without the '-quotes' suffix. Used when no start URLs or author are provided.

## `author` (type: `string`):

Author name. Used when no start URLs are provided (e.g., 'Albert Einstein').

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

Stop after saving this many quotes across all topics and start URLs.

## `maxPages` (type: `integer`):

How many paginated pages to visit per topic (including the first page).

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

Optional. BrainyQuote is Cloudflare-protected; a residential proxy improves reliability, but any proxy you trust works. Leave empty to run without a proxy. Proxy access does not guarantee a request is allowed.

## Actor input object example

```json
{
  "topic": "motivational",
  "maxItems": 20,
  "maxPages": 3
}
```

# 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 = {
    "topic": "motivational"
};

// Run the Actor and wait for it to finish
const run = await client.actor("shahidirfan/brainyquote-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 = { "topic": "motivational" }

# Run the Actor and wait for it to finish
run = client.actor("shahidirfan/brainyquote-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 '{
  "topic": "motivational"
}' |
apify call shahidirfan/brainyquote-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,shahidirfan/brainyquote-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/RNFpZdqz2wBhISZHA/builds/E8Rthh2i3uDWjvooa/openapi.json
