Fix crash when yande.re post source has no link

pull/17/head
neobooru 2024-07-11 23:06:54 +02:00
parent 593c4cef0d
commit cfbd9652ec
2 changed files with 2 additions and 2 deletions

View File

@ -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",

View File

@ -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