Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 6x 6x 6x 3x 3x 3x 3x 2x 1x | /**
* Utility functions for parsing HTML content
*/
/**
* Extracts the direct document link from a document HTML page
* @param html The HTML content of the document page
* @returns The direct link to the document or null if not found
*/
export function extractDocumentLink(html: string): string | null {
// Look for the direct link pattern in the HTML
const directLinkRegex = /<a href="(getraw\/[^"]+)">Directe link naar document<\/a>/;
const directLinkMatch = html.match(directLinkRegex);
if (directLinkMatch && directLinkMatch[1]) {
return directLinkMatch[1];
}
// If direct link not found, try to find the iframe source
const iframeRegex = /<iframe[^>]*src=['"]\.?\/(getraw\/[^'"]+)['"]/;
const iframeMatch = html.match(iframeRegex);
if (iframeMatch && iframeMatch[1]) {
return iframeMatch[1];
}
return null;
}
|