MastodonTootsLoader#

class langchain_community.document_loaders.mastodon.MastodonTootsLoader(mastodon_accounts: Sequence[str], number_toots: int | None = 100, exclude_replies: bool = False, access_token: str | None = None, api_base_url: str = 'https://mastodon.social')[source]#

Load the Mastodon ‘toots’.

Instantiate Mastodon toots loader.

Parameters:
  • mastodon_accounts (Sequence[str]) – The list of Mastodon accounts to query.

  • number_toots (Optional[int]) – How many toots to pull for each account. Defaults to 100.

  • exclude_replies (bool) – Whether to exclude reply toots from the load. Defaults to False.

  • access_token (Optional[str]) – An access token if toots are loaded as a Mastodon app. Can also be specified via the environment variables “MASTODON_ACCESS_TOKEN”.

  • api_base_url (str) – A Mastodon API base URL to talk to, if not using the default. Defaults to “https://mastodon.social”.

Methods

__init__(mastodon_accounts[, number_toots, ...])

Instantiate Mastodon toots loader.

alazy_load()

A lazy loader for Documents.

aload()

Load data into Document objects.

lazy_load()

Load toots into documents.

load()

Load data into Document objects.

load_and_split([text_splitter])

Load Documents and split into chunks.

__init__(mastodon_accounts: Sequence[str], number_toots: int | None = 100, exclude_replies: bool = False, access_token: str | None = None, api_base_url: str = 'https://mastodon.social')[source]#

Instantiate Mastodon toots loader.

Parameters:
  • mastodon_accounts (Sequence[str]) – The list of Mastodon accounts to query.

  • number_toots (int | None) – How many toots to pull for each account. Defaults to 100.

  • exclude_replies (bool) – Whether to exclude reply toots from the load. Defaults to False.

  • access_token (str | None) – An access token if toots are loaded as a Mastodon app. Can also be specified via the environment variables “MASTODON_ACCESS_TOKEN”.

  • api_base_url (str) – A Mastodon API base URL to talk to, if not using the default. Defaults to “https://mastodon.social”.

async alazy_load() AsyncIterator[Document]#

A lazy loader for Documents.

Return type:

AsyncIterator[Document]

async aload() list[Document]#

Load data into Document objects.

Return type:

list[Document]

lazy_load() Iterator[Document][source]#

Load toots into documents.

Return type:

Iterator[Document]

load() list[Document]#

Load data into Document objects.

Return type:

list[Document]

load_and_split(text_splitter: TextSplitter | None = None) list[Document]#

Load Documents and split into chunks. Chunks are returned as Documents.

Do not override this method. It should be considered to be deprecated!

Parameters:

text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns:

List of Documents.

Return type:

list[Document]

Examples using MastodonTootsLoader