# ApifyDatasetLoader

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/apify_dataset/ApifyDatasetLoader)

Load datasets from `Apify` web scraping, crawling, and data extraction platform.

For details, see https://docs.apify.com/platform/integrations/langchain

## Signature

```python
ApifyDatasetLoader(
    self,
    dataset_id: str,
    dataset_mapping_function: Callable[[Dict], Document],
)
```

## Description

**Example:**

.. code-block:: python

from langchain_community.document_loaders import ApifyDatasetLoader
from langchain_core.documents import Document

loader = ApifyDatasetLoader(
    dataset_id="YOUR-DATASET-ID",
    dataset_mapping_function=lambda dataset_item: Document(
        page_content=dataset_item["text"], metadata={"source": dataset_item["url"]}
    ),
)
documents = loader.load()

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `dataset_id` | `str` | Yes | The ID of the dataset on the Apify platform. |
| `dataset_mapping_function` | `Callable` | Yes | A function that takes a single dictionary (an Apify dataset item) and converts it to an instance of the Document class. |

## Extends

- `BaseLoader`
- `BaseModel`

## Constructors

```python
__init__(
    self,
    dataset_id: str,
    dataset_mapping_function: Callable[[Dict], Document],
)
```

| Name | Type |
|------|------|
| `dataset_id` | `str` |
| `dataset_mapping_function` | `Callable[[Dict], Document]` |


## Properties

- `apify_client`
- `dataset_id`
- `dataset_mapping_function`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-community/document_loaders/apify_dataset/ApifyDatasetLoader/validate_environment)
- [`load()`](https://reference.langchain.com/python/langchain-community/document_loaders/apify_dataset/ApifyDatasetLoader/load)

## ⚠️ Deprecated

Deprecated since version 0.3.18.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/document_loaders/apify_dataset.py#L10)