From cfbd9652ec567892affa71bd1803d403adda0bb4 Mon Sep 17 00:00:00 2001 From: neobooru <50623835+neobooru@users.noreply.github.com> Date: Thu, 11 Jul 2024 23:06:54 +0200 Subject: [PATCH] Fix crash when yande.re post source has no link --- package.json | 2 +- src/engines/Moebooru.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e461d7b..20a8b0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "neo-scraper", - "version": "0.9.1", + "version": "0.9.2", "description": "Scrape a booru-like post object from the DOM.", "type": "module", "main": "dist/index.js", diff --git a/src/engines/Moebooru.ts b/src/engines/Moebooru.ts index 32b7131..eaf6d63 100644 --- a/src/engines/Moebooru.ts +++ b/src/engines/Moebooru.ts @@ -38,7 +38,7 @@ export default class Moebooru extends ScrapeEngineBase { const matches = el.innerText.match(regex); if (matches && matches.length == 3) { // If Source element - if (matches[1] == "Source") { + if (matches[1] == "Source" && el.children.length > 0) { post.sources = [(el.children[0] as HTMLAnchorElement).href]; } // If Rating element