# Get Tripadvisor URLs (`h_reviews/get-tripadvisor-urls`) Actor

Find Tripadvisor URLs starting from geographical coordinates.

- **URL**: https://apify.com/h\_reviews/get-tripadvisor-urls.md
- **Developed by:** [Hospitality](https://apify.com/h_reviews) (Apify)
- **Categories:** Travel
- **Stats:** 39 total users, 0 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: 4.60 out of 5 stars

## Pricing

from $0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Tripadvisor URLs

Finds Tripadvisor places' URLs in a geographical search area.

### Input

To get started, you need an initial point with its geographical coordinates, in degrees, which will be the center of the search area.
Then, choose the place type (either `restaurant` or `hotel`) and, optionally, a string to match with the place's name.

The queries must be formatted like this, with the values separated by comma, without white spaces around commas:

```
Latitude,longitude,place-type,match-string
```

Finally, choose the maximum distance from the center point. The API in use allows a maximum distance up to around 500 meters.

Here is a sample input:

```json
{
	"queries": [
		"44.2073275,-69.8277909,restaurant,Popeyes Louisiana Kitchen",
		"43.410405,-70.5582322,restaurant,Popeyes Louisiana Kitchen",
		"43.636905,-70.3363167,restaurant"
	],
	"maxResultsPerQuery": 1,
	"maxDistanceInMeters": 25,
	"matchStringTolerance": 1
}

```

As you can see, `maxResultsPerQuery` is `1`, because we are trying to match exactly some places we already know, and find their URLs on Tripadvisor.
Also, notice that the third query does not provide a string to match. Even if that's the case, we would still like to match a "Popeyes Louisiana Kitchen" in this example.

### Output

Here is a sample output, originated from the previous input:

```json
[
    {
        "query": "44.2073275,-69.8277909,restaurant,Popeyes Louisiana Kitchen",
        "url": "https://www.tripadvisor.com/Restaurant_Review-g40891-d21201667-Reviews-Popeyes_Louisiana_Kitchen-South_Gardiner_Maine.html",
        "id": 21201667,
        "name": "Popeyes Louisiana Kitchen",
        "lat": 44.20733,
        "lng": -69.82779,
        "distance": 0.28709411850707856,
        "nameScore": 0
    },
    {
        "query": "43.636905,-70.3363167,restaurant",
        "url": "https://www.tripadvisor.com/Restaurant_Review-g40894-d12030525-Reviews-Popeyes_Louisiana_Kitchen-South_Portland_Maine.html",
        "id": 12030525,
        "name": "Popeyes Louisiana Kitchen",
        "lat": 43.636906,
        "lng": -70.33632,
        "distance": 0.2879064202290549
    }
]
```

From this output, we can see that:

1. The first query matched the correct place.
2. The second query didn't produce any result. In fact, the API returned the following results, none of which matched the input string "Popeyes Louisiana Kitchen", meaning that the place we're interested in is not available on Tripadvisor:
   - Kennebunk South Travel Plaza
   - Burger King
   - Auntie Anne's
   - Dunkin'
   - Dunkin' (another one)
3. The third query matched a "Popeyes Louisiana Kitchen", as we wished. Indeed, if you don't provide a string to match, the scraper will sort the results by distance from the center point and will give you the closest ones.

# Actor input Schema

## `queries` (type: `array`):

The initial queries made from latitude, longitude, place type ("restaurant" or "hotel") and, optionally, name, separated by comma.

## `maxResultsPerQuery` (type: `integer`):

Maximum number of results to provide for each query. This Actor is intended to produce a single exact match.

## `maxDistanceInMeters` (type: `integer`):

Maximum allowed distance, in meters, from the given coordinates.

## `matchStringTolerance` (type: `integer`):

Maximum allowed Levenshtein distance, used to compare strings. Lower means closer (0 = perfect match). A typical value is 1.

## Actor input object example

```json
{
  "queries": [
    "50.08177111814712,14.404632185654782,restaurant,Czech Slovak Restaurant"
  ],
  "maxResultsPerQuery": 1,
  "maxDistanceInMeters": 25,
  "matchStringTolerance": 1
}
```

# 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 = {
    "queries": [
        "50.08177111814712,14.404632185654782,restaurant,Czech Slovak Restaurant"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("h_reviews/get-tripadvisor-urls").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 = { "queries": ["50.08177111814712,14.404632185654782,restaurant,Czech Slovak Restaurant"] }

# Run the Actor and wait for it to finish
run = client.actor("h_reviews/get-tripadvisor-urls").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 '{
  "queries": [
    "50.08177111814712,14.404632185654782,restaurant,Czech Slovak Restaurant"
  ]
}' |
apify call h_reviews/get-tripadvisor-urls --silent --output-dataset

```

## MCP server setup

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

```

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/YZeQI2W9wnT61UNeE/builds/m9foiDankwBPZjWA9/openapi.json
