langchain_community.document_loaders.reddit.RedditPostsLoader

class langchain_community.document_loaders.reddit.RedditPostsLoader(client_id: str, client_secret: str, user_agent: str, search_queries: Sequence[str], mode: str, categories: Sequence[str] = ['new'], number_posts: Optional[int] = 10)[source]

Load Reddit posts.

Read posts on a subreddit. First, you need to go to https://www.reddit.com/prefs/apps/ and create your application

Initialize with client_id, client_secret, user_agent, search_queries, mode,

categories, number_posts.

Example: https://www.reddit.com/r/learnpython/

Parameters
  • client_id – Reddit client id.

  • client_secret – Reddit client secret.

  • user_agent – Reddit user agent.

  • search_queries – The search queries.

  • mode – The mode.

  • categories – The categories. Default: [“new”]

  • number_posts – The number of posts. Default: 10

Methods

__init__(client_id, client_secret, ...[, ...])

Initialize with client_id, client_secret, user_agent, search_queries, mode,

lazy_load()

A lazy loader for Documents.

load()

Load reddits.

load_and_split([text_splitter])

Load Documents and split into chunks.

__init__(client_id: str, client_secret: str, user_agent: str, search_queries: Sequence[str], mode: str, categories: Sequence[str] = ['new'], number_posts: Optional[int] = 10)[source]
Initialize with client_id, client_secret, user_agent, search_queries, mode,

categories, number_posts.

Example: https://www.reddit.com/r/learnpython/

Parameters
  • client_id – Reddit client id.

  • client_secret – Reddit client secret.

  • user_agent – Reddit user agent.

  • search_queries – The search queries.

  • mode – The mode.

  • categories – The categories. Default: [“new”]

  • number_posts – The number of posts. Default: 10

lazy_load() Iterator[Document]

A lazy loader for Documents.

load() List[Document][source]

Load reddits.

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 RedditPostsLoader