langchain_community.document_loaders.mastodon.MastodonTootsLoader

class langchain_community.document_loaders.mastodon.MastodonTootsLoader(mastodon_accounts: Sequence[str], number_toots: Optional[int] = 100, exclude_replies: bool = False, access_token: Optional[str] = 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.

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: Optional[int] = 100, exclude_replies: bool = False, access_token: Optional[str] = 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 (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”.

async alazy_load() AsyncIterator[Document]

A lazy loader for Documents.

Return type

AsyncIterator[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: Optional[TextSplitter] = 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