This started as backend/scraper inside Vroomy, because a typing race needs a lot of text to type. Once it had grown its own queues, migrations and production setup, I moved it into its own project. The only thing it shares with Vroomy now is the Postgres database: the crawler owns the quotes table and is the only one writing to it, and Vroomy's API reads from it.
By the numbers
At the last restart the database held 4,317,599 quotes, and it keeps growing.
| Source | Quotes |
|---|---|
| Goodreads | 2,253,206 |
| Wikiquote EN | 923,457 |
| Wikiquote IT | 516,064 |
| Wikiquote PL | 253,357 |
| Wikiquote FR | 78,059 |
| Wikiquote ES | 72,738 |
| 9 more editions | ~220,000 |
By language that's 3.18M English quotes and the rest spread over Italian, Polish, French, Spanish, Finnish, Portuguese, Czech, German, Hungarian, Swedish, Norwegian, Romanian and Danish.
How it works
- Frontier. Every URL is recorded once in Postgres and queued in a per-source Redis sorted set. Goodreads URLs are scored by page type, so deep pagination (where the unseen quotes are) runs before popular first pages, and chains that keep returning duplicates are pushed down.
- Discovery. Wikiquote editions pull batches of 500 random article titles from the MediaWiki API. Goodreads is walked through pagination, tags, keyword searches and author names harvested from the rest of the corpus.
- Parsing. Each source has a parser behind a common interface. Wikiquote's layout differs by language, so there's an English one, a German one and a shared localized one for the other editions. Parsers are tested against saved HTML.
- Saving. Quotes go through the quality filters (length, script, leaked wiki markup, untypeable characters), then the exact and near-duplicate checks, and are inserted in batches.
The crawler identifies itself following the Wikimedia User-Agent policy and doesn't render JavaScript or get around any access controls. Store tests run against real Postgres and Redis in throwaway containers with testcontainers-go.