# Franchise Directories Scraper (Franchise Direct) (`accommodating_aptitude/franchise-directories`) Actor

Pulls publicly listed franchise opportunity listings from franchisedirect.com category pages: title, minimum investment (price), category, link and optional location.

- **URL**: https://apify.com/accommodating_aptitude/franchise-directories.md
- **Developed by:** [Korhan Coşan Ergün](https://apify.com/accommodating_aptitude) (community)
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 86.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 listing founds

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/actors/running/actors-in-store.md#pay-per-event

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

## Franchise Directories Scraper (franchisedirect.com)

Pulls publicly listed franchise opportunity listings with title, minimum
investment (price), category and link; optionally also extracts the
location from the detail page.

### Why franchisedirect.com and not bizbuysell.com?

The task description gave `abotapi/bizbuysell-scraper` as a competing
example. **Checked on 9 November 2026:** bizbuysell.com is protected by
Akamai bot management and rejects every kind of automated request (plain
`curl`/`httpx` as well as a real Chromium browser session) with
**"Access Denied"** at the edge level — including the request for
`robots.txt` itself. Since even robots.txt is unreachable, compliance with
its rules cannot be tested — the site is already technically closed to
access. On top of that, the bizbuysell.com Terms of Use page contains the
industry-standard general clause banning automated data collection/bots.
For that reason, in line with the task instruction, the actor switched to a
**publicly accessible alternative franchise directory**.

**franchisedirect.com robots.txt** (verified 9 November 2026):

- For the generic `User-agent: *` **all paths are allowed**, with only a
  `Crawl-delay: 30` seconds requirement.
- Only certain aggressive SEO/data bots (AhrefsBot, SemrushBot, MJ12bot,
  Yandex, Baiduspider, etc.) are fully blocked — this actor is not one of
  them.
- Query parameters such as `?sort=`, `?filter=`, `?page=` and the paths
  `/tag/`, `/preview/`, `/draft/`, `/search?` are on the disallow list —
  this actor does not use them, it only pulls plain category pages (like
  `/foodfranchises/14`).

This actor checks robots.txt with `RobotsChecker` before every request and
skips the URL if it is not allowed; `RespectfulClient` honours the
robots.txt crawl delay (30s) between requests per host.

### Data source and method

The page is **server-side rendered** (no JavaScript needed — verified: the
HTML fetched with a plain `httpx` request contains the same `.ProfilePromo`
listing cards as the browser). It is parsed with `BeautifulSoup`. No
login/signup/payment form is used; only publicly accessible category
listing pages.

### Input

| Field | Description |
|---|---|
| `categoryUrls` | franchisedirect.com category page URLs |
| `maxItemsPerCategory` | Maximum listings per category |
| `fetchLocation` | If `true`, the detail page is fetched for every listing as well (the "Available Locations" field). Because of the robots.txt crawl-delay=30s this is **slow** (~30s per listing), so use it for small numbers of listings. |

### Output (each record)

```json
{
  "id": "www.franchisedirect.com/food-franchises/pure-green",
  "title": "Pure Green",
  "link": "https://www.franchisedirect.com/food-franchises/pure-green/",
  "date": null,
  "source_url": "https://www.franchisedirect.com/foodfranchises/14",
  "scraped_at": "2026-11-10T00:28:36Z",
  "source": "franchisedirect.com",
  "category": "Find Food Franchise Opportunities for Sale | Franchise Direct",
  "price_min_usd": 100000,
  "price_text": "$100,000",
  "location": "Opportunities available throughout the US.",
  "description": "Pure Green Franchise is on a mission to build healthier communities..."
}
```

`sample_output.json` contains **13 records** taken from a real local run:
5 from the Food Franchises category (including location, detail page
fetched) + 8 from the Cleaning Franchises category (without location, fast
mode).

### Pricing (PPE)

A `listing-found` event is fired for every listing found
(`Actor.charge("listing-found")`).

### Local run

```bash
cd ~/rua/products/apify/franchise-directories
mkdir -p storage/key_value_stores/default
cat > storage/key_value_stores/default/INPUT.json <<'EOF'
{"categoryUrls": ["https://www.franchisedirect.com/foodfranchises/14"], "maxItemsPerCategory": 5, "fetchLocation": false}
EOF
APIFY_LOCAL=1 python3 main.py
## output: storage/datasets/default/*.json
```

### Known limitations

- `fetchLocation=true` is slow because of the ~30 second crawl delay per
  listing; keeping it off is recommended for high-volume runs.
- The location is usually a general phrase such as "throughout the US";
  bizbuysell-style city/state-level specific locations do not exist on this
  site (franchise directories list brands/opportunities, not individual
  business-for-sale listings like bizbuysell).
- The price field is the "minimum investment" (the cost of opening a
  franchise), which is not exactly the same thing as bizbuysell's "asking
  price" — this niche difference should be noted in the report.

# Actor input Schema

## `categoryUrls` (type: `array`):

franchisedirect.com category/listing pages (e.g. https://www.franchisedirect.com/foodfranchises/14). If empty, the default categories are used.

## `maxItemsPerCategory` (type: `integer`):

How many listings at most to pull from each category page.

## `fetchLocation` (type: `boolean`):

If enabled, the detail page is fetched for every listing as well (the 'Available Locations' field). It is slow because of the robots.txt crawl-delay=30s, so use it for small numbers of listings.

## Actor input object example

```json
{
  "categoryUrls": [
    "https://www.franchisedirect.com/foodfranchises/14",
    "https://www.franchisedirect.com/cleaningfranchises/11"
  ],
  "maxItemsPerCategory": 10,
  "fetchLocation": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all records found in this run.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("accommodating_aptitude/franchise-directories").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("accommodating_aptitude/franchise-directories").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 '{}' |
apify call accommodating_aptitude/franchise-directories --silent --output-dataset

```

## MCP server setup

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

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/E8MeeEUYVR9Z8PJGU/builds/x1QmEJKzchcflZ0FW/openapi.json
