Support recursive sitemaps in SitemapLoader (#3146)

A (very) simple addition to support multiple sitemap urls.

---------

Co-authored-by: Johann-Peter Hartmann <johann-peter.hartmann@mayflower.de>
fix_agent_callbacks
Johann-Peter Hartmann 1 year ago committed by GitHub
parent 215dcc2d26
commit 7e79f8c136
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -61,6 +61,13 @@ class SitemapLoader(WebBaseLoader):
}
)
for sitemap in soup.find_all("sitemap"):
loc = sitemap.find("loc")
if not loc:
continue
soup_child = self.scrape_all([loc.text], "xml")[0]
els.extend(self.parse_sitemap(soup_child))
return els
def load(self) -> List[Document]:

Loading…
Cancel
Save