fixed dlsite-maniax non-image file download process
This commit is contained in:
parent
0d280b26fd
commit
4710cbccbd
3 changed files with 9 additions and 11 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -23,16 +23,14 @@ function Reader(page: PageOrFrame, readerUrl: string) {
|
|||
await page.goto(readerUrl);
|
||||
},
|
||||
async downloadUrl(): Promise<null | string> {
|
||||
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;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue