Skip to main content
Compatibility: Only available on Node.js.
This notebook provides a quick overview for getting started with RecursiveUrlLoader. For detailed documentation of all RecursiveUrlLoader features and configurations head to the API reference.

Overview

Integration details

Loader features

When loading content from a website, we may want to process load all URLs on a page. For example, let’s look at the LangChain.js introduction docs. This has many interesting child pages that we may want to load, split, and later retrieve in bulk. The challenge is traversing the tree of child pages and assembling a list! We do this using the RecursiveUrlLoader. This also gives us the flexibility to exclude some children, customize the extractor, and more.

Setup

To access RecursiveUrlLoader document loader you’ll need to install the @langchain/community integration, and the jsdom package.

Credentials

If you want to get automated tracing of your model calls you can also set your LangSmith API key by uncommenting below:

Installation

The LangChain RecursiveUrlLoader integration lives in the @langchain/community package:
We also suggest adding a package like html-to-text or @mozilla/readability for extracting the raw text from the page.
We also suggest adding a package like html-to-text or @mozilla/readability for extracting the raw text from the page.

Instantiation

Now we can instantiate our model object and load documents:

Load

Options

However, since it’s hard to perform a perfect filter, you may still see some irrelevant results in the results. You can perform a filter on the returned documents by yourself, if it’s needed. Most of the time, the returned results are good enough.

API reference

For detailed documentation of all RecursiveUrlLoader features and configurations head to the API reference.