8000 Give promoted seed domains priority in the crawler by daoudclarke · Pull Request #499 · mwmbl/mwmbl · GitHub
[go: up one dir, main page]

Skip to content

Give promoted seed domains priority in the crawler - #499

Open
daoudclarke wants to merge 1 commit into
mainfrom
crawler-promoted-domains
Open

daoudclarke wants to merge 1 commit into
mainfrom
crawler-promoted-domains

Conversation

@daoudclarke
Copy link
Copy Markdown
Contributor

What changed

The crawler now uses the promoted (seed) domains from GET /api/v2/combined-search/seed-domains alongside curated domains, and gives them priority.

  • Fetching (mwmbl/crawl.py): _fetch_promoted_domains() calls the endpoint with the crawler's MWMBL_API_KEY (it needs a crawl-scoped key). It keeps the server's best-first order and drops domains scoring 0, which have no new pages left. It asks at most hourly, since the list is republished daily, and waits the hour after a failure too, so a key without the crawl scope doesn't ask on every batch. A crawler with no key has no promoted domains.
  • Queueing (mwmbl/redis_url_queue.py):
    • Up to 50 promoted domains with URLs queued go at the front of each batch, in score order, ahead of core and curated domains.
    • The batch's seed root page comes from a promoted domain the crawler has never seen, falling back to the HN/curated list once every promoted domain is queued.
    • Promoted domains queue as many URLs as curated ones (1000).
    • Blacklisted promoted domains are skipped.
  • MWMBL_SERVER env var (default https://api.mwmbl.org) so the crawler can run against a local server.

Why

Seed domains are scored by how likely a crawl is to add new pages that answer searches, so volunteer crawlers should spend their budget there first.

Verification

  • New test/test_promoted_domains.py (ordering, seeding, blacklist, queue depth, fetching). make check and make test pass (1160 passed).
  • Ran mwmbl-crawl --once three times against a local dev server with a crawl-scoped key and three seed domains (danluu.com 5, jvns.ca 3, example.org 0), using a spare Redis DB and submission off:
    1. Fetched 2 promoted domains (example.org dropped) and seeded https://jvns.ca/.
    2. jvns.ca led the batch, and https://danluu.com/ was seeded.
    3. The batch started with danluu.com, jvns.ca, then the core domains. The seed fell back to the HN list.

One known cost: a promoted domain whose queue runs out can have its root page re-seeded until the next daily republish lowers its score. That is at most one URL per batch.

🤖 Generated with Claude Code

The crawler reads the seed domains endpoint with its API key and puts the
best queued ones at the front of each batch, ahead of core and curated
domains. A promoted domain with nothing queued is seeded by its root page,
and promoted domains queue as deeply as curated ones. Domains scoring zero
are dropped, and MWMBL_SERVER lets a crawler run against a local server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@blueheron786
Copy link
Copy Markdown
Collaborator

Can we prioritize this PR? We have around 8700 seed sites discovered so far, and we're accumulating more each day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0