diff --git a/src/media.js b/src/media.js index 90c78bda..379b8bd7 100644 --- a/src/media.js +++ b/src/media.js @@ -200,8 +200,6 @@ async function findSourceDuplicates(baseMedias) { knex('media').whereIn('source_page', extractUrls), ]); - console.log(sourceUrls, existingSourceMedia); - const existingSourceMediaByUrl = itemsByKey(existingSourceMedia, 'source'); const existingExtractMediaByUrl = itemsByKey(existingExtractMedia, 'source_page'); @@ -776,12 +774,12 @@ async function flushOrphanedMedia() { .delete(); await Promise.all(orphanedMedia.map(media => Promise.all([ - fsPromises.unlink(path.join(config.media.path, media.path)).catch(() => { /* probably file not found */ }), - fsPromises.unlink(path.join(config.media.path, media.thumbnail)).catch(() => { /* probably file not found */ }), - fsPromises.unlink(path.join(config.media.path, media.lazy)).catch(() => { /* probably file not found */ }), + media.path && fsPromises.unlink(path.join(config.media.path, media.path)).catch(() => { /* probably file not found */ }), + media.thumbnail && fsPromises.unlink(path.join(config.media.path, media.thumbnail)).catch(() => { /* probably file not found */ }), + media.lazy && fsPromises.unlink(path.join(config.media.path, media.lazy)).catch(() => { /* probably file not found */ }), ]))); - logger.info(`Removed ${orphanedMedia.length} media files from database and disk`); + logger.info(`Removed ${orphanedMedia.length} media files from database and storage`); await fsPromises.rmdir(path.join(config.media.path, 'temp'), { recursive: true }); diff --git a/src/scrapers/czechav.js b/src/scrapers/czechav.js index 36ebeef2..4852b9a8 100644 --- a/src/scrapers/czechav.js +++ b/src/scrapers/czechav.js @@ -12,7 +12,8 @@ function scrapeAll(scenes, channel) { release.title = query.cnt('.nice-title'); release.poster = query.img('img.poster'); - release.photos = query.q('img.poster', 'data-urls').split(' '); + release.photos = query.q('img.poster', 'data-urls')?.split(' '); + release.teaser = query.video('img.poster', 'data-thumbnail'); if (query.exists('.info')) { release.date = query.date('.updated', 'MM/DD/YYYY'); diff --git a/src/scrapers/traxxx.js b/src/scrapers/traxxx.js index 054edb49..a0768097 100644 --- a/src/scrapers/traxxx.js +++ b/src/scrapers/traxxx.js @@ -3,13 +3,12 @@ async function fetchLatest() { return [ { - title: 'Hot chicks arse fucked', + title: 'Hot chick arse fucked', date: new Date(), }, ]; } - module.exports = { fetchLatest, };