AZLyricsLoader#
- class langchain_community.document_loaders.azlyrics.AZLyricsLoader(web_path: str | Sequence[str] = '', header_template: dict | None = None, verify_ssl: bool = True, proxies: dict | None = None, continue_on_failure: bool = False, autoset_encoding: bool = True, encoding: str | None = None, web_paths: Sequence[str] = (), requests_per_second: int = 2, default_parser: str = 'html.parser', requests_kwargs: Dict[str, Any] | None = None, raise_for_status: bool = False, bs_get_text_kwargs: Dict[str, Any] | None = None, bs_kwargs: Dict[str, Any] | None = None, session: Any = None, *, show_progress: bool = True)[source]#
Load AZLyrics webpages.
Initialize loader.
- Parameters:
web_paths (Sequence[str]) β Web paths to load from.
requests_per_second (int) β Max number of concurrent requests to make.
default_parser (str) β Default parser to use for BeautifulSoup.
requests_kwargs (Dict[str, Any] | None) β kwargs for requests
raise_for_status (bool) β Raise an exception if http status code denotes an error.
bs_get_text_kwargs (Dict[str, Any] | None) β kwargs for beatifulsoup4 get_text
bs_kwargs (Dict[str, Any] | None) β kwargs for beatifulsoup4 web page parsing
show_progress (bool) β Show progress bar when loading pages.
web_path (str | Sequence[str]) β
header_template (dict | None) β
verify_ssl (bool) β
proxies (dict | None) β
continue_on_failure (bool) β
autoset_encoding (bool) β
encoding (str | None) β
session (Any) β
Attributes
web_path
Methods
__init__
([web_path,Β header_template,Β ...])Initialize loader.
A lazy loader for Documents.
aload
()Load text from the urls in web_path async into Documents.
fetch_all
(urls)Fetch all urls concurrently with rate limiting.
Lazy load text from the url(s) in web_path.
load
()Load webpages into Documents.
load_and_split
([text_splitter])Load Documents and split into chunks.
scrape
([parser])Scrape data from webpage and return it in BeautifulSoup format.
scrape_all
(urls[,Β parser])Fetch all urls, then return soups for all results.
- __init__(web_path: str | Sequence[str] = '', header_template: dict | None = None, verify_ssl: bool = True, proxies: dict | None = None, continue_on_failure: bool = False, autoset_encoding: bool = True, encoding: str | None = None, web_paths: Sequence[str] = (), requests_per_second: int = 2, default_parser: str = 'html.parser', requests_kwargs: Dict[str, Any] | None = None, raise_for_status: bool = False, bs_get_text_kwargs: Dict[str, Any] | None = None, bs_kwargs: Dict[str, Any] | None = None, session: Any = None, *, show_progress: bool = True) None #
Initialize loader.
- Parameters:
web_paths (Sequence[str]) β Web paths to load from.
requests_per_second (int) β Max number of concurrent requests to make.
default_parser (str) β Default parser to use for BeautifulSoup.
requests_kwargs (Dict[str, Any] | None) β kwargs for requests
raise_for_status (bool) β Raise an exception if http status code denotes an error.
bs_get_text_kwargs (Dict[str, Any] | None) β kwargs for beatifulsoup4 get_text
bs_kwargs (Dict[str, Any] | None) β kwargs for beatifulsoup4 web page parsing
show_progress (bool) β Show progress bar when loading pages.
web_path (str | Sequence[str]) β
header_template (dict | None) β
verify_ssl (bool) β
proxies (dict | None) β
continue_on_failure (bool) β
autoset_encoding (bool) β
encoding (str | None) β
session (Any) β
- Return type:
None
- async alazy_load() AsyncIterator[Document] #
A lazy loader for Documents.
- Return type:
AsyncIterator[Document]
- aload() List[Document] #
Load text from the urls in web_path async into Documents.
- Return type:
List[Document]
- async fetch_all(urls: List[str]) Any #
Fetch all urls concurrently with rate limiting.
- Parameters:
urls (List[str]) β
- Return type:
Any
- lazy_load() Iterator[Document] #
Lazy load text from the url(s) in web_path.
- 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]
- scrape(parser: str | None = None) Any #
Scrape data from webpage and return it in BeautifulSoup format.
- Parameters:
parser (str | None) β
- Return type:
Any
- scrape_all(urls: List[str], parser: str | None = None) List[Any] #
Fetch all urls, then return soups for all results.
- Parameters:
urls (List[str]) β
parser (str | None) β
- Return type:
List[Any]
Examples using AZLyricsLoader