Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Sitemap Extractor: overlap sitemap download with crawling (enqueue URLs as they are parsed, don't block on full enumeration)

Aperta
#339 10 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
47/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
backend, web-dev

Direzione di ricerca

Start by locating the sitemap ingestion code that calls Crawlee's Sitemap.load() and then adds sitemap.urls to the request queue; the issue does not name the relevant files or tests. Review Crawlee's Sitemap.fromXmlString() API and how the crawler is started. Done means child sitemap URLs enter the queue as they are parsed, bounded concurrency is respected, and crawling proceeds concurrently rather than waiting for full sitemap enumeration.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

t-universe

Summary

When useSitemaps is enabled, the scrapers currently enumerate the entire sitemap tree before the crawler processes any page. For large sites whose sitemap index references hundreds of child sitemaps, this serial "download-all-sitemaps-first" phase dominates run time and frequently exhausts the run timeout before real crawling even begins.

Proposal: stream sitemap URLs into the request queue as each child sitemap is parsed, and start the crawler concurrently, so sitemap I/O overlaps with page processing.

Evidence

From a large-scale test — 500 domains (250 most-popular + 250 random), run through a Crawlee-based Sitemap Extractor over an Apr–Jun 2026 usage window:

  • Top-250 popular sites averaged ~2,355 sitemap URLs/domain vs ~290 for the random sample (~8× more).
  • 83 of 500 runs hit the 1-hour timeout, disproportionately the large sites — they spent the bulk of the run downloading/parsing sitemaps and never got through the enqueued links. Their discovered-page counts are truncated as a result.

Root cause

Crawlee's Sitemap.load() (the standard path) collects every URL from the whole sitemap tree — following the sitemap index and all child sitemaps — into a single urls array, and only returns once complete. The actor then calls crawler.addRequests(sitemap.urls). So wall-clock is effectively sitemap_download_time + crawl_time, fully serial.

(Confirmed against the Crawlee Sitemap API, which exposes load() / fromXmlString() / tryCommonNames() but no incremental/streaming consumption — all URLs surface only after the full tree is loaded.)

Proposed fix

Turn sitemap ingestion into a producer/consumer that overlaps with crawling:

  1. Fetch the sitemap index first to obtain the list of child-sitemap URLs.
  2. Download child sitemaps with a bounded-concurrency pool (e.g. 10–20), parsing each with Sitemap.fromXmlString() (or a streaming parser) rather than the monolithic load().
  3. As each child sitemap resolves, immediately await requestQueue.addRequests(batch) — don't wait for the rest.
  4. Start the crawler concurrently (don't await full enumeration). Crawlee's autoscaled pool pulls URLs as soon as they land in the queue.

Result: wall-clock drops from sitemap_time + crawl_time to roughly max(sitemap_time, crawl_time), and large sites make real crawl progress before hitting the timeout.

Notes

  • Cap per-host sitemap concurrency to avoid triggering anti-bot (see the related Unblocker issue).
  • Complements a separate sitemap download-optimization issue (streaming XML, gzip, keep-alive, incremental skip).

🤖 Filed from a data-driven analysis with Claude Code, based on a 500-domain Sitemap Extractor test (Apr–Jun 2026).

Lingua principale
TypeScript
Stelle
149
Fork
59
Merge medio
9g 13h
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apify/actor-scraper

Tutte le issue di apify/actor-scraper

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.