Fixed off-by-one in photo plucker. Fixed source duplicate photo function not handling fallback sources.

This commit is contained in:
2019-12-12 04:04:35 +01:00
parent dbaf1a9a9c
commit 0b819713b5
5 changed files with 30 additions and 36 deletions

View File

@@ -18,13 +18,13 @@ function scrapePhotos(html) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const photos = $('.photo_gallery_thumbnail_wrapper .thumbs')
.map((photoIndex, photoElement) => {
.toArray()
.map((photoElement) => {
const src = $(photoElement).attr('src');
// high res often available in photos/ directory, but not always, provide original as fallback
return [src.replace('thumbs/', 'photos/'), src];
})
.toArray();
});
return photos;
}