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 – The list of Mastodon accounts to query.

  • number_toots – How many toots to pull for each account. Defaults to 100.

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

  • access_token – 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 – 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.

lazy_load()

A lazy loader for Documents.

load()

Load toots into documents.

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 – The list of Mastodon accounts to query.

  • number_toots – How many toots to pull for each account. Defaults to 100.

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

  • access_token – 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 – A Mastodon API base URL to talk to, if not using the default. Defaults to “https://mastodon.social”.

lazy_load() Iterator[Document]

A lazy loader for Documents.

load() List[Document][source]

Load toots into documents.

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]

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

Parameters

text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

Examples using MastodonTootsLoader