# Leafly Cannabis Strain Scraper (`lulzasaur/leafly-scraper`) Actor

Scrape cannabis strain data from Leafly. Get strain names, types (indica/sativa/hybrid), THC/CBD levels, effects, flavors, ratings, review counts, and terpene profiles from the largest cannabis database.

- **URL**: https://apify.com/lulzasaur/leafly-scraper.md
- **Developed by:** [lulz bot](https://apify.com/lulzasaur) (community)
- **Categories:** E-commerce
- **Stats:** 8 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 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

## Leafly Cannabis Strain Scraper

Scrape cannabis strain data from [Leafly](https://www.leafly.com) -- the world's largest cannabis information resource with 6,000+ strain profiles.

### What it does

- **Browse mode**: Scrape all strains alphabetically, optionally filtering by type (indica/sativa/hybrid)
- **Search mode**: Search for specific strains by name
- **Detail mode**: Optionally fetch individual strain pages for full effects, flavors, terpenes, lineage, and medical conditions

Extracts data from Leafly's server-rendered ****NEXT\_DATA**** -- no JavaScript rendering needed.

### Input Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `searchQueries` | array | Strain names to search for (e.g. "Blue Dream", "OG Kush"). Leave empty to browse all |
| `strainType` | string | Filter by type: indica, sativa, hybrid, or any |
| `maxResults` | integer | Max number of strains to scrape. Default: 20, max: 5000 |
| `includeDetails` | boolean | Fetch detail pages for full effects/flavors/description. Default: false |
| `proxyConfiguration` | object | Proxy settings (residential recommended) |

### Output Fields

Each result contains:

| Field | Type | Description |
|-------|------|-------------|
| `name` | string | Strain name (e.g. "Blue Dream") |
| `slug` | string | URL slug |
| `type` | string | indica, sativa, or hybrid |
| `thc` | number | Median THC percentage |
| `thcRange` | string | THC range (e.g. "17%-22%") |
| `cbd` | number | Median CBD percentage |
| `topEffect` | string | Primary reported effect |
| `effects` | array | Top 5 effects by user votes |
| `flavors` | array | Top 5 flavors (detail mode) |
| `rating` | number | Average user rating (0-5) |
| `reviewCount` | number | Number of user reviews |
| `topTerpene` | string | Dominant terpene |
| `terpenes` | array | Top 3 terpenes (detail mode) |
| `lineage` | array | Parent strain names (detail mode) |
| `helpsWith` | array | Medical conditions users report help with (detail mode) |
| `description` | string | Strain description |
| `imageUrl` | string | Strain photo URL |
| `sourceUrl` | string | Leafly strain page URL |
| `scrapedAt` | string | ISO 8601 timestamp |

### Example Output

```json
{
  "name": "Blue Dream",
  "slug": "blue-dream",
  "type": "hybrid",
  "thc": 21,
  "thcRange": "17%-24%",
  "cbd": 0,
  "topEffect": "relaxed",
  "effects": ["relaxed", "happy", "euphoric", "creative", "uplifted"],
  "rating": 4.34,
  "reviewCount": 15234,
  "topTerpene": "myrcene",
  "description": "Blue Dream is a sativa-dominant hybrid...",
  "imageUrl": "https://images.leafly.com/flower-images/...",
  "sourceUrl": "https://www.leafly.com/strains/blue-dream",
  "scrapedAt": "2026-04-26T10:00:00.000Z"
}
```

### Example Inputs

#### Browse all indica strains

```json
{
  "strainType": "indica",
  "maxResults": 50
}
```

#### Search for specific strains with full details

```json
{
  "searchQueries": ["Blue Dream", "OG Kush", "Girl Scout Cookies"],
  "includeDetails": true,
  "maxResults": 10
}
```

### How it works

1. Fetches Leafly's strain listing pages which contain server-rendered data in `__NEXT_DATA__`
2. Extracts strain profiles including THC/CBD levels, effects, ratings, and terpenes
3. Optionally fetches individual strain detail pages for enriched data (lineage, medical conditions, full descriptions)
4. Applies type and search filters client-side for precise results

# Actor input Schema

## `searchQueries` (type: `array`):

List of strain names to search for (e.g. 'Blue Dream', 'OG Kush'). Leave empty to browse all strains.

## `strainType` (type: `string`):

Filter by strain type.

## `maxResults` (type: `integer`):

Maximum number of strains to scrape.

## `includeDetails` (type: `boolean`):

Fetch individual strain pages for full details (effects, flavors, description). Slower but more data.

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

Select proxies to be used by your scraper.

## Actor input object example

```json
{
  "searchQueries": [],
  "strainType": "",
  "maxResults": 20,
  "includeDetails": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("lulzasaur/leafly-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 = { "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    } }

# Run the Actor and wait for it to finish
run = client.actor("lulzasaur/leafly-scraper").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 '{
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call lulzasaur/leafly-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/K2ypq8BkfJmUXMSyf/builds/YFEfnGFGrcZ89M9nf/openapi.json
