Fixed invalid URL breaking scrape, prefixing reddit URLs with origin.

This commit is contained in:
2024-09-11 05:16:59 +02:00
parent b1e13e048c
commit e642203d6c
6 changed files with 115 additions and 467 deletions

View File

@@ -20,8 +20,8 @@ async function redditAlbum(host, post) {
url: host.url,
title: post.title,
},
items: items.map(url => ({
id: new URL(url).pathname.match(/\/(.*).jpg/)[1],
items: items.map((url) => ({
id: new URL(url).pathname.match(/\/(.*).\w+$/)?.[1],
url,
datetime: post.datetime,
type: mime.getType(url) || 'image/jpeg',