langchain_community.document_loaders.twitter
.TwitterTweetLoader¶
- class langchain_community.document_loaders.twitter.TwitterTweetLoader(auth_handler: Union[OAuthHandler, OAuth2BearerHandler], twitter_users: Sequence[str], number_tweets: Optional[int] = 100)[source]¶
Load Twitter tweets.
Read tweets of the user’s Twitter handle.
First you need to go to https://developer.twitter.com/en/docs/twitter-api /getting-started/getting-access-to-the-twitter-api to get your token. And create a v2 version of the app.
Methods
__init__
(auth_handler, twitter_users[, ...])from_bearer_token
(oauth2_bearer_token, ...)Create a TwitterTweetLoader from OAuth2 bearer token.
from_secrets
(access_token, ...[, number_tweets])Create a TwitterTweetLoader from access tokens and secrets.
A lazy loader for Documents.
load
()Load tweets.
load_and_split
([text_splitter])Load Documents and split into chunks.
- __init__(auth_handler: Union[OAuthHandler, OAuth2BearerHandler], twitter_users: Sequence[str], number_tweets: Optional[int] = 100)[source]¶
- classmethod from_bearer_token(oauth2_bearer_token: str, twitter_users: Sequence[str], number_tweets: Optional[int] = 100) TwitterTweetLoader [source]¶
Create a TwitterTweetLoader from OAuth2 bearer token.
- classmethod from_secrets(access_token: str, access_token_secret: str, consumer_key: str, consumer_secret: str, twitter_users: Sequence[str], number_tweets: Optional[int] = 100) TwitterTweetLoader [source]¶
Create a TwitterTweetLoader from access tokens and secrets.
- 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.