RSSFeedLoader#
- class langchain_community.document_loaders.rss.RSSFeedLoader(urls: Sequence[str] | None = None, opml: str | None = None, continue_on_failure: bool = True, show_progress_bar: bool = False, **newsloader_kwargs: Any)[source]#
Load news articles from RSS feeds using Unstructured.
- Parameters:
urls (Sequence[str] | None) β URLs for RSS feeds to load. Each articles in the feed is loaded into its own document.
opml (str | None) β OPML file to load feed urls from. Only one of urls or opml should be provided. The value
string (can be a URL) β
string. (or OPML markup contents as byte or) β
continue_on_failure (bool) β If True, continue loading documents even if loading fails for a particular URL.
show_progress_bar (bool) β If True, use tqdm to show a loading progress bar. Requires tqdm to be installed,
pip install tqdm
.**newsloader_kwargs (Any) β Any additional named arguments to pass to NewsURLLoader.
Example
from langchain_community.document_loaders import RSSFeedLoader loader = RSSFeedLoader( urls=["<url-1>", "<url-2>"], ) docs = loader.load()
The loader uses feedparser to parse RSS feeds. The feedparser library is not installed by default so you should install it if using this loader: https://pythonhosted.org/feedparser/
If you use OPML, you should also install listparser: https://pythonhosted.org/listparser/
Finally, newspaper is used to process each article: https://newspaper.readthedocs.io/en/latest/
Initialize with urls or OPML.
Methods
__init__
([urls,Β opml,Β continue_on_failure,Β ...])Initialize with urls or OPML.
A lazy loader for Documents.
aload
()Load data into Document objects.
A lazy loader for Documents.
load
()Load data into Document objects.
load_and_split
([text_splitter])Load Documents and split into chunks.
- __init__(urls: Sequence[str] | None = None, opml: str | None = None, continue_on_failure: bool = True, show_progress_bar: bool = False, **newsloader_kwargs: Any) None [source]#
Initialize with urls or OPML.
- Parameters:
urls (Sequence[str] | None) β
opml (str | None) β
continue_on_failure (bool) β
show_progress_bar (bool) β
newsloader_kwargs (Any) β
- Return type:
None
- async alazy_load() AsyncIterator[Document] #
A lazy loader for Documents.
- Return type:
AsyncIterator[Document]
- lazy_load() Iterator[Document] [source]#
A lazy loader for Documents.
- Return type:
Iterator[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 RSSFeedLoader