# Perplexity.AI Actor (`jons/perplexity-actor`)

Use the Perplexity.ai Scraper to extract information with AI. For example: "Find hotels in Prague that offer free breakfast and have a nightly rate under 1000 CZK." Export the results into a structured dataset.

- **URL**: https://beta-securitybyobscurity.apify.com/jons/perplexity-actor.md
- **Developed by:** [Jon](https://beta-securitybyobscurity.apify.com/jons) (community)
- **Categories:** AI
- **Stats:** 104 total users, 8 monthly users, 73.2% runs succeeded, 9 bookmarks
- **User rating**: 1.00 out of 5 stars

## Pricing

$30.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.
You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

# README

## Perplexity.ai Crawler

This crawler lets you input one or multiple search terms and leverages the Perplexity.ai search engine to find relevant information.
It then extracts the data and provides a structured output.
Whether you're looking for hotel deals, market research, or any other data, this tool can streamline the process.

You can perform multiple searches simultaneously by providing an array of search terms. Each term will correspond to a separate item in the output.

Example input: the only required field is `searchTerms`

```json
    "searchTerms": [
        "Find hotels in Prague that offer free breakfast and have a nightly rate under 1000 CZK."
    ],
```

Example output:

```json
[
  {
      "related_queries": [
          "Which hotels in Prague offer the best free breakfast options",
          "Are there any luxury hotels in Prague with free breakfast under 1000 CZK",
          "What are the top-rated hotels in Prague 1 with free breakfast",
          "Can I find hotels with free breakfast in Prague City Center for under 1000 CZK",
          "Which hotels in Prague 3 offer free breakfast and are under 1000 CZK"
      ],
      "thread_url_slug": "https://www.perplexity.ai/search/find-hotels-in-prague-that-off-WLP2eksrRMCwpn4frn3ijg",
      "data": {
          "answer": "Several hotels in Prague offer free breakfast with nightly rates under 1000 CZK. Here are some options:\n\n1. **Hotel Maestro by Adrez**: This hotel provides free WiFi and amenities such as a restaurant, desk, and shower. It is listed among affordable options with free breakfast.\n\n2. **Betlem Club Hotel**: Frequently mentioned as offering free breakfast, this hotel is likely to fall within your desired price range.\n\n3. **Hotel Tyl**: Known for providing free breakfast, it is another option that may fit your budget.\n\n4. **Hotel Adalbert**: This hotel also offers free breakfast, making it a potential choice for budget-conscious travelers.\n\n5. **Friday Hotel**: Listed among those offering complimentary breakfast, it is suggested to be within your budget constraints.\n\nWhile these hotels are likely to be in the affordable range, actual rates can vary based on the season and availability. It's advisable to check specific travel dates for the most accurate pricing[2].",
          "web_results": [
              {
                  "url": "http://www.praha.eu",
                  "name": "1. Prague"
              },
              {
                  "url": "https://apify.com/jons/perplexity-actor",
                  "name": "2. Perplexity.AI Actor - Apify"
              },
              {
                  "url": "https://www.kayak.com/Prague-Hotels.19865.hotel.ksp",
                  "name": "3. 16 Best Hotels in Prague. Hotels from $14/night - KAYAK"
              },
              {
                  "url": "https://www.traveloka.com/en-id/hotel/czech-republic/don-giovanni-hotel-prague---great-hotels-of-the-world-1000000179076",
                  "name": "4. Don Giovanni Hotel Prague - Great Hotels of the World, Praha 3 ..."
              },
              {
                  "url": "https://www.expedia.com/Prague-Hotels.d180014.Travel-Guide-Hotels",
                  "name": "5. The Best Hotels in Prague from $44 | Expedia"
              },
              {
                  "url": "https://uk.hotels.com/de1634829-qu0/cheap-hotels-prague-czech-republic/",
                  "name": "6. The Best Cheap Hotels in Prague from £35 - Book on Hotels.com"
              },
              {
                  "url": "https://www.expedia.co.uk/Prague-Hotels.d180014.Travel-Guide-Hotels",
                  "name": "7. Best Prague Hotels from £34 - Expedia.co.uk"
              },
              {
                  "url": "https://www.tripadvisor.com/HotelsList-Prague-Hotels-With-Complimentary-Breakfast-zfp10848969.html",
                  "name": "8. THE 10 BEST Prague Hotels with Free Breakfast 2024 (with Prices)"
              },
              {
                  "url": "https://www.tripadvisor.com/ShowUserReviews-g274707-d1546504-r949345109-Hotel_PurPur-Prague_Bohemia.html?m=27208",
                  "name": "9. Decent - Review of Hotel PurPur, Prague, Czech Republic ..."
              }
          ]
      }
  }
]
```

# Actor input Schema

## `runMode` (type: `string`):

This property indicates the scraper's mode of operation. In DEVELOPMENT mode, the scraper ignores page timeouts, doesn't use sessionPool, opens pages one by one and enables debugging via Chrome DevTools.  Open the live view tab or the container URL to access the debugger. Further debugging options can be configured in the Advanced configuration section. PRODUCTION mode disables debugging and enables timeouts and concurrency. <br><br>For details, see <a href='https://apify.com/apify/web-scraper#run-mode' target='_blank' rel='noopener'>Run mode</a> in README.

## `searchTerms` (type: `array`):

A list of search terms to use for the search. Each search term will run as a separate search.

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

Specifies proxy servers that will be used by the scraper in order to hide its origin.<br><br>For details, see <a href='https://apify.com/apify/web-scraper#proxy-configuration' target='_blank' rel='noopener'>Proxy configuration</a> in README.

## `proxyRotation` (type: `string`):

This property indicates the strategy of proxy rotation and can only be used in conjunction with Apify Proxy. The recommended setting automatically picks the best proxies from your available pool and rotates them evenly, discarding proxies that become blocked or unresponsive. If this strategy does not work for you for any reason, you may configure the scraper to either use a new proxy for each request, or to use one proxy as long as possible, until the proxy fails. IMPORTANT: This setting will only use your available Apify Proxy pool, so if you don't have enough proxies for a given task, no rotation setting will produce satisfactory results.

## Actor input object example

```json
{
  "runMode": "DEVELOPMENT",
  "searchTerms": [
    "What are the common symptoms of COVID-19?"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "proxyRotation": "RECOMMENDED"
}
```

# 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 = {
    "runMode": "DEVELOPMENT",
    "searchTerms": [
        "What are the common symptoms of COVID-19?"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("jons/perplexity-actor").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 = {
    "runMode": "DEVELOPMENT",
    "searchTerms": ["What are the common symptoms of COVID-19?"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("jons/perplexity-actor").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 '{
  "runMode": "DEVELOPMENT",
  "searchTerms": [
    "What are the common symptoms of COVID-19?"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call jons/perplexity-actor --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Perplexity.AI Actor",
        "description": "Use the Perplexity.ai Scraper to extract information with AI. For example: \"Find hotels in Prague that offer free breakfast and have a nightly rate under 1000 CZK.\" Export the results into a structured dataset.",
        "version": "0.0",
        "x-build-id": "d0dc6KEmoa0WBbKIE"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/jons~perplexity-actor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-jons-perplexity-actor",
                "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/jons~perplexity-actor/runs": {
            "post": {
                "operationId": "runs-sync-jons-perplexity-actor",
                "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/jons~perplexity-actor/run-sync": {
            "post": {
                "operationId": "run-sync-jons-perplexity-actor",
                "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": [
                    "proxyConfiguration",
                    "searchTerms"
                ],
                "properties": {
                    "runMode": {
                        "title": "Run mode",
                        "enum": [
                            "PRODUCTION",
                            "DEVELOPMENT"
                        ],
                        "type": "string",
                        "description": "This property indicates the scraper's mode of operation. In DEVELOPMENT mode, the scraper ignores page timeouts, doesn't use sessionPool, opens pages one by one and enables debugging via Chrome DevTools.  Open the live view tab or the container URL to access the debugger. Further debugging options can be configured in the Advanced configuration section. PRODUCTION mode disables debugging and enables timeouts and concurrency. <br><br>For details, see <a href='https://apify.com/apify/web-scraper#run-mode' target='_blank' rel='noopener'>Run mode</a> in README.",
                        "default": "PRODUCTION"
                    },
                    "searchTerms": {
                        "title": "Search terms",
                        "type": "array",
                        "description": "A list of search terms to use for the search. Each search term will run as a separate search.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Specifies proxy servers that will be used by the scraper in order to hide its origin.<br><br>For details, see <a href='https://apify.com/apify/web-scraper#proxy-configuration' target='_blank' rel='noopener'>Proxy configuration</a> in README.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    },
                    "proxyRotation": {
                        "title": "Proxy rotation",
                        "enum": [
                            "RECOMMENDED",
                            "PER_REQUEST",
                            "UNTIL_FAILURE"
                        ],
                        "type": "string",
                        "description": "This property indicates the strategy of proxy rotation and can only be used in conjunction with Apify Proxy. The recommended setting automatically picks the best proxies from your available pool and rotates them evenly, discarding proxies that become blocked or unresponsive. If this strategy does not work for you for any reason, you may configure the scraper to either use a new proxy for each request, or to use one proxy as long as possible, until the proxy fails. IMPORTANT: This setting will only use your available Apify Proxy pool, so if you don't have enough proxies for a given task, no rotation setting will produce satisfactory results.",
                        "default": "RECOMMENDED"
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
