From 20286ace8d17e90c905c6ca032a0f2cfcfaab195 Mon Sep 17 00:00:00 2001 From: lukas Date: Wed, 13 Nov 2024 18:04:27 +0100 Subject: [PATCH] feat(VIL-621): adding nopagination option to archive --- .gitignore | 1 + src/archive.ts | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index de4f868..61c4b63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Logs .DS*Store +.idea logs *.log npm-debug.log\_ diff --git a/src/archive.ts b/src/archive.ts index d25c120..d5ff06d 100644 --- a/src/archive.ts +++ b/src/archive.ts @@ -19,6 +19,17 @@ const SELECTORS = { }; const PHASES = [1, 2, 3]; +/** + * Récupère l'URL de l'archive. Ajoute le paramètre nopagination pour éviter la pagination. + * @param baseUrl + * @param pathName + */ +async function getArchiveUrl(baseUrl: string, pathName: string = ''): Promise { + const url = new URL(`${baseUrl}/${pathName}`); + // Ajouter le paramètre nopagination + url.searchParams.append('nopagination', 'true'); + return url.toString(); +} async function gotoWithRetry(page: Page, url: string, maxAttempts = 5): Promise { for (let attempt = 1; attempt <= maxAttempts; attempt++) { @@ -72,7 +83,8 @@ async function archivePage(dirPath: string, page: Page, ressources: Record