# YELP Extractor 2.1 🚧 (`jupri/yelp`) Actor

💫 Scrape Business data from Yelp.com

- **URL**: https://apify.com/jupri/yelp.md
- **Developed by:** [cat](https://apify.com/jupri) (community)
- **Categories:** Other
- **Stats:** 430 total users, 3 monthly users, 100.0% runs succeeded, 9 bookmarks
- **User rating**: 2.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

## 💫 Welcome to Yelp Scraper

<img height="32" src="https://apify.com/actor-badge?actor=B99C518reTdjhdetP">

![enter image description here](https://img.freepik.com/premium-vector/abstract-oriental-cat-head-portrait-from-multicolored-paints-abyssinian-cat-colored-drawing_537015-259.jpg?w=240)

### 🍂 About Yelp.com

<img height="128" src="https://upload.wikimedia.org/wikipedia/commons/a/ad/Yelp_Logo.svg">

**Yelp Inc.** is an American company that develops the Yelp.com website and the Yelp [mobile app](https://en.wikipedia.org/wiki/Mobile_app "Mobile app"), which publish [crowd-sourced](https://en.wikipedia.org/wiki/Crowd-sourced "Crowd-sourced") reviews about businesses. It also operates Yelp Guest Manager, a [table reservation](https://en.wikipedia.org/wiki/Table_reservation "Table reservation") service. It is headquartered in [San Francisco, California](https://en.wikipedia.org/wiki/San_Francisco,_California "San Francisco, California").

### 🍂 About This Actor

**Features :**

- ⭐ Search Business
- ⭐ Scrape Business detailed info
- ⭐ Scrape Reviews, Media, Question, Quick-Tips
- ⭐ Scrape User data
- ⭐ Accept URL input
- ⭐ Accept Map Box input

> **Disclaimer**: Yelp Website only allows maximum **240** results per request

### 🍂 Tutorial

#### 🍃 Parameter

| Parameter | Type | Description |
|-|-|-|
| `query` | ***string*** |<code>Keywords</code>, <code>URL</code>, <code>Business IDs</code> or QUERY |
| `location` | ***string*** | Place or Map box `(max_lon,max_lat,min_lon,min_lat)` |
| `limit` | ***integer*** | Maximum number of results |
| `language` | ***string*** | Expected Language output (ISO-639)

#### 🍃 Basic Usage

Search business by `keywords`.

```yaml
{
    "query": "scraper",
    "location": "New York",
    "limit": 5
}
```

#### 🍃 Advanced Usage

##### YELP Query Language (YQL)

```html
[ <COMMAND:> | # | @ ] [ <NAME> | <ID> | <KEYWORD> | <URL> ] [ /<SECTION> ] 
```

***Possible `QUERY`  values***

| Format | Example | Description
|-|-|-|
| **<*KEYWORDS*>** | `square pants` |**Search Anything**|
| **<*BIZ_ALIAS*>** | `truffles-mystery-immersive-new-york` | **Business Data** |
| **<*BIZ_ID*>** | `agz8qfhZTWIHVvD6ltE78A` | |
| `/info` | `truffles-mystery-immersive-new-york/info` | Business info |
|  | `agz8qfhZTWIHVvD6ltE78A/info` | |
| `/reviews` | `agz8qfhZTWIHVvD6ltE78A/reviews` | Business reviews |
| `/media` | `agz8qfhZTWIHVvD6ltE78A/media` | Business media (photo + video) |
| `/questions` | `agz8qfhZTWIHVvD6ltE78A/questions` | Question list |
| `/quicktips` | `agz8qfhZTWIHVvD6ltE78A/quicktips` | Quick-Tips list |
| **col:<*COLLECTION_ID*>** | `col:UVu0ldCQN1RCQqs1KQlnPA` | **Collection Data** |
| `/info` | `col:UVu0ldCQN1RCQqs1KQlnPA/info` | Collection info
| `/items` | `col:UVu0ldCQN1RCQqs1KQlnPA/items` | Collection items
| **@<*USER_ID*>** | | ***User Data*** |
| | | *🚧... working in progress ...  🚧* |
| **https:<*URL*>** | `https://www.yelp.com` | **Start URL** |
| | `https://www.yelp.com/search ...` | Search |
| | `https://www.yelp.com/biz/ ...` | Business |
| | `https://www.yelp.com/collection/ ...` | Collection |
| | *🚧 ... to be continued ...  🚧* |

### 🍂  Examples

#### Example #1:  Searching

Searching business by `keywords`.

```yaml
{ "query": "scraper", "location": "New York", "limit": 5 }
```

Search Map `(max_lon,max_lat,min_lon,min_lat)`

```yaml
{ "query": "scraper", "location": "-87.583,41.950,-87.757,41.873", "limit": 5 }
```

Search business by `Search URL`

```yaml
{
    "query": "https://www.yelp.com/search?find_desc=Scraper&find_loc=New+York&open_now=5653",
    "location": "New York", # overrides location
    "limit": 5
}
```

#### Examples #2: Business IDs

Search specific `business IDs`. The example below scrape for 3 business IDs

```yaml
{ "query": "UtknyDJ_DPut-FKRqs0wpQ Hz6Fs0yAT8WH3XlqxbxliA QhDrHjMOQOL4_MqtRJIu1Q" }
```

Business info using `URL`

```yaml
{ "query": "https://www.yelp.com/biz/truffles-mystery-immersive-new-york" }
```

or

```yaml
{ "query": "#truffles-mystery-immersive-new-york" }
```

#### Example #3: Focusing on Other Data

Scrape reviews: `<BIZ_ID>/reviews`

```yaml
{ "query": "UtknyDJ_DPut-FKRqs0wpQ/reviews", "limit": 10 }
```

Scrape media:  `<BIZ_ID>/media`

```yaml
{ "query": "UtknyDJ_DPut-FKRqs0wpQ/media", "limit": 10 }
```

### 🍂  Output Samples

<img width="240" src="https://www.healthprochiro.com/wp-content/uploads/2022/09/under-const.jpg">

### 🍂  Support

⚡️ Feel free to [reach out](https://console.apify.com/actors/B99C518reTdjhdetP/issues) to the developer for any issues or suggestions for improvement.

<img src="https://apify-uploads-prod.s3.us-east-1.amazonaws.com/5SxZhwYwpknFk8ek9-cat.gif" width="240">

# Actor input Schema

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

💡 <b>Possible QUERY Values :</b><br><li>Search <code>keywords</code></li><li><code>Search URL</code></li><li>Business <code>IDs</code> separated by spaces, comma or breaklines.</li>

## `limit` (type: `integer`):

💡 Number of results.

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

💡 ISO-639 Language code. <i><code>example: "en"</code></i>

## `location` (type: `string`):

💡 Location : <li><b>Place name</b><br><i><code>example: "New York"</code></i></li><li><b>Map Bounding Box</b><br><code>max_lon, max_lat, min_lon, min_lat</code><br><i><code>example: -87.583,41.950,-87.757,41.873</code></i></li>

## `category` (type: `string`):

No description

## `sort` (type: `string`):

No description

## `include_media` (type: `integer`):

💡 Number of media

## `media_category` (type: `string`):

💡 Fetch only specific media group/tab. <i><code>(examples: "food" or "interior")</code></i>

## `media_group` (type: `boolean`):

No description

## `include_reviews` (type: `integer`):

💡 Number of review

## `reviews_search` (type: `string`):

💡 Search reviews.

## `reviews_sort` (type: `string`):

No description

## `reviews_rating` (type: `string`):

No description

## `include_question` (type: `integer`):

💡 Number of question

## `question_sort` (type: `string`):

No description

## `include_tips` (type: `integer`):

💡 Number of quicktips

## `include_rating` (type: `boolean`):

💡 Rating counts

## `dev_proxy_config` (type: `object`):

💡 <b>Supported protocol:</b><br><br><b>HTTP(S), SOCKS5</b><br><code>{http|socks5}://{user:pass}@{hostname|ip-address}:port</code><br><br><b>Example</b>: <code>socks5://example.com:9000</code>

## `dev_custom_headers` (type: `array`):

💡 Additional HTTP Headers

## `dev_custom_cookies` (type: `array`):

💡 Additional HTTP Cookies

## `dev_transform_fields` (type: `array`):

💡 <b>Transform the resulting output. Select only needed fields.</b><br><br>For nested object use <b>DOT</b>. For example: <pre>address.streetAddress</pre><br>For nested array use <b>NUMBER</b> <i>(index of array element starting from index=0)</i>. For example: <pre>images.0.url</pre>

## `dev_dataset_name` (type: `string`):

💡 <b>Save results into custom named Dataset, use mask to customize dataset name</b><br><br><code>{ACTOR} = actor name<br>{DATE} = date (YYYYMMDD)<br>{TIME} = time (HHMMSS)</code><br><br>This masks can be used to autogenerate Dataset Name.<br><br>example: <i><code>data-{DATE}</code></i><br>Depending on today date the dataset name will be: <code>data-20230603</code><i><br><br>default: <code>data-{ACTOR}-{DATE}-{TIME}</code></i>

## `dev_dataset_clear` (type: `boolean`):

Clear Dataset before insert/update.

## `dev_no_strip` (type: `boolean`):

💡 Keep/Save empty values <i><code>(NULL, FALSE, empty ARRAY, empty OBJECT, empty STRING)</code></i>

## Actor input object example

```json
{
  "query": "reverse engineer",
  "limit": 5,
  "language": "en",
  "location": "New York"
}
```

# 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 = {
    "query": "reverse engineer",
    "limit": 5,
    "language": "en",
    "location": "New York"
};

// Run the Actor and wait for it to finish
const run = await client.actor("jupri/yelp").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 = {
    "query": "reverse engineer",
    "limit": 5,
    "language": "en",
    "location": "New York",
}

# Run the Actor and wait for it to finish
run = client.actor("jupri/yelp").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 '{
  "query": "reverse engineer",
  "limit": 5,
  "language": "en",
  "location": "New York"
}' |
apify call jupri/yelp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jupri/yelp"
        }
    }
}
```

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/B99C518reTdjhdetP/builds/F4yo98rfA9CoSPtgh/openapi.json
