# 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. Use langchain_apify.ApifyDatasetLoader instead. This class is deprecated and will be removed in a future version. You can swap to using the `ApifyDatasetLoader` implementation in `langchain_apify` package. See <https://github.com/apify/langchain-apify>

---

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