Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

fix(sitemap): recognize sitemap_index as a valid input sitemap url (#3909)

Luigi Ruoccoeacab5e155ae
diff --git a/packages/utils/src/internals/sitemap.ts b/packages/utils/src/internals/sitemap.ts
index 3139d8e24..0df0ade0b 100644
--- a/packages/utils/src/internals/sitemap.ts
+++ b/packages/utils/src/internals/sitemap.ts
@@ -598,7 +598,7 @@ export async function* discoverValidSitemaps(
log.warning(`Failed to fetch robots.txt file for ${hostname}`, { error: err });
}
- const sitemapUrl = domainUrls.find((url) => /sitemap\.(?:xml|txt)(?:\.gz)?$/i.test(url));
+ const sitemapUrl = domainUrls.find((url) => /sitemap(?:_index)?\.(?:xml|txt)(?:\.gz)?$/i.test(url));
if (sitemapUrl !== undefined) {
if (addSitemapUrl(sitemapUrl)) {