TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import type { ConnectorMeta, CrawlContext } from '@rareindex/connectors';2import type { ExtractionResult } from '@rareindex/shared';3import { goauctionPageUrl, parseGoauctionCalendar, parseGoauctionLots, type GoauctionHouse } from '../_g8-auctions-eu-apac-lib/goauction-platform.js';4import { SaleResultsConnector, type HouseConfig, type ParsedSalePage, type SaleRef } from '../_g8-auctions-eu-apac-lib/sale-results.js';56/**7 * Sworders Fine Art Auctioneers (Stansted Mountfitchet, Essex) — goauction platform. Results calendar /results/8 * (title, date, sale number, au id) → lot grid /auction/details/<slug>/?au=<id>&pn=N&g=1 (96 lots per page,9 * "Sold for £1,800", <link rel="next">). Sworders publishes hammer prices on its results pages (its terms describe10 * the buyer's premium as added to the hammer price); the grid itself does not label the basis → left null.11 */12const HOUSE: GoauctionHouse = { base: 'https://www.sworder.co.uk', currency: 'GBP', listStyle: 'details' };1314export class SwordersConnector extends SaleResultsConnector {15 readonly version = '1.0.0';16 readonly house: HouseConfig = { houseName: 'Sworders', defaultCurrency: 'GBP', location: 'Stansted Mountfitchet, United Kingdom', idKey: 'sworders_lot', premiumIncluded: null, fallbackSlug: 'antiques', minIntervalMs: 2500, maxPagesPerSale: 20 };17 protected override minIntervalMs = 2500;1819 async listSales(ctx: CrawlContext): Promise<SaleRef[]> {20 const url = String(this.meta.config.resultsUrl ?? `${HOUSE.base}/results/`);21 await this.throttle(url);22 const res = await ctx.fetch(url, { engines: ['api'], responseType: 'text', minQuality: 0, timeoutMs: 60_000 });23 if (!res.success || !res.html) {24 ctx.anomaly('past_list_failed', `${url}: ${res.error ?? res.httpStatus}`);25 return [];26 }27 return parseGoauctionCalendar(res.html, HOUSE);28 }2930 salePageUrl(sale: SaleRef, page: number): string {31 return goauctionPageUrl(sale, page, HOUSE);32 }3334 parseSalePage(res: ExtractionResult, sale: SaleRef): ParsedSalePage | null {35 return res.html ? parseGoauctionLots(res.html, sale, HOUSE) : null;36 }37}3839export default function createConnector(meta: ConnectorMeta) {40 return new SwordersConnector(meta);41}42