From 4710cbccbd0782eacd90c02378691c25ccb72aa8 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Sat, 26 Oct 2024 00:44:29 +0900 Subject: [PATCH] fixed dlsite-maniax non-image file download process --- package-lock.json | 4 ++-- package.json | 2 +- platforms/dlsite-maniax.ts | 14 ++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index bd78de8..0f87222 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@fogtype/gadl", - "version": "1.6.0", + "version": "1.6.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@fogtype/gadl", - "version": "1.6.0", + "version": "1.6.1", "license": "AGPL-3.0", "dependencies": { "fflate": "^0.8.1", diff --git a/package.json b/package.json index 6aae56f..dcac3b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fogtype/gadl", - "version": "1.6.0", + "version": "1.6.1", "license": "AGPL-3.0", "type": "module", "bin": "bin/run.js", diff --git a/platforms/dlsite-maniax.ts b/platforms/dlsite-maniax.ts index 83b2c87..7cc8529 100644 --- a/platforms/dlsite-maniax.ts +++ b/platforms/dlsite-maniax.ts @@ -23,16 +23,14 @@ function Reader(page: PageOrFrame, readerUrl: string) { await page.goto(readerUrl); }, async downloadUrl(): Promise { - const isBook = workId.startsWith("B"); + const url = `https://www.dlsite.com/home/download/=/product_id/${workId}.html`; - if (isBook) { - // PDFファイルでないことを確認 - const items = await page.waitForSelector(workTreeItemsSelector); - const text = await items.textContent(); - if (!text?.match(/PDFファイル/u)) return null; - } + if (!workId.startsWith("B")) return url; - return `https://www.dlsite.com/home/download/=/product_id/${workId}.html`; + const items = await page.waitForSelector(workTreeItemsSelector); + const text = await items.textContent(); + + return text?.match(/画像/) ? null : url; }, }; }