pcso-lotto-web-scraper
Version:
26 lines (25 loc) • 880 B
TypeScript
export interface Payload {
from: string | Date;
to?: string | Date;
filter?(result: Result): boolean;
}
export interface Result {
game: Game;
combinations: number[];
drawDate: Date;
jackpot: number;
winners: number;
}
export type Game = 'Ultra Lotto 6/58' | 'Grand Lotto 6/55' | 'Superlotto 6/49' | 'Megalotto 6/45' | 'Lotto 6/42' | '6D Lotto' | '4D Lotto' | '3D Lotto 2PM' | '3D Lotto 5PM' | '3D Lotto 9PM' | '2D Lotto 2PM' | '2D Lotto 5PM' | '3D Lotto 9PM';
export default class LottoScraper {
private readonly url;
private readonly headers;
private initialDomWindow?;
constructor(url?: string, headers?: Record<string, string>);
get(payload: Payload): Promise<Array<Result>>;
private extractResults;
private getDomWindow;
private getResultDomWindow;
private createFormBody;
private getInitialDomWindow;
}