Compare commits

...

2 Commits

Author SHA1 Message Date
baebe7d5aa tumblr.isRepost() always returns a boolean 2024-05-28 22:20:03 -06:00
9b9d25504e fix errors with missing descriptions 2024-05-28 22:19:24 -06:00
2 changed files with 8 additions and 3 deletions

9
lib.js
View File

@ -210,7 +210,7 @@ export const createPosts = async (channel, source, fromDate, reducerCallback) =>
export const createPost = (item, source) => {
let description = item.querySelector('description')
description = description === null ? '' : new JSDOM(description.textContent).window.document
description = new JSDOM(description === null ? '' : description.textContent).window.document
let date = readPubDate(item.querySelector('pubDate'))
let link = item.querySelector('link')?.textContent
@ -424,12 +424,14 @@ export const imageExtensions = {
'image/avif': '.avif',
'image/bmp': '.bmp',
'image/gif': '.gif',
'image/gifv': '.gifv',
'image/vnd.microsoft.icon': '.icon',
'image/jpeg': '.jpg',
'image/png': '.png',
'image/svg+xml': '.xml',
'image/tiff': '.tif',
'image/webp': '.webp'
'image/webp': '.webp',
'image/webm': '.gifv'
}
export const pullImages = async (post, view, discardPostIfNoImages = false, getPostId = getPostIdFromPathname) => {
@ -550,6 +552,7 @@ export const writeView = (sources, feeds, view) => {
}
for(let page of pages) {
console.log('Writing page', page)
writePage(page, view)
}
@ -596,6 +599,8 @@ export const createPages = (list, view) => {
}
}
console.log(list)
return pages
}

View File

@ -27,7 +27,7 @@ tumblr.createSource = (user, options, postReducerCallback, cache) => {
tumblr.isRepost = (post) => {
let reblog = post.description.querySelector('p > a.tumblr_blog')
return reblog && reblog.innerHTML !== post.source.user
return reblog ? reblog.innerHTML !== post.source.user : false
}
tumblr.matchesTags = (post, whitelist, blacklist) => {