Skip to main content

latest
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
76%
Published
5 months ago (0.1.18)
Package root>src>api>parser.ts
// @ts-types="npm:@types/jsdom@21.1.7" import jsdom from "npm:jsdom@25.0.1"; /** * Parse the HTML response from the server. * * @param html The raw text response * @returns The parsed DOM */ export function parseResponse(html: string): string { const content = new jsdom.JSDOM(html); return content.window.document.querySelector("main")?.textContent ?? ""; } /** * Get the time (in milliseconds) the page says we must wait before re-submitting the solution. * * @param dom The raw text response * @returns The required delay in milliseconds. Defaults to 1 minute. */ export function getDelayMs(html: string) { const content = new jsdom.JSDOM(html); const main = content.window.document.querySelector("main"); if (!main) { return 60_000; } // TODO: check this for real! return 60_000; }