Added Sperm Swallowers and The Ass Factory to Jules Jordan scraper. Added photo source.
This commit is contained in:
14
src/media.js
14
src/media.js
@@ -112,8 +112,16 @@ async function filterHashDuplicates(files, domains = ['releases'], roles = ['pho
|
||||
|
||||
async function fetchPhoto(photoUrl, index, identifier, attempt = 1) {
|
||||
if (Array.isArray(photoUrl)) {
|
||||
return fetchPhoto(photoUrl[0], index, identifier);
|
||||
// return photoUrl.reduce(async (outcome, url) => outcome.catch(async () => fetchPhoto(url, index, identifier)), Promise.reject());
|
||||
// return fetchPhoto(photoUrl[0], index, identifier);
|
||||
return photoUrl.reduce(async (outcome, url) => outcome.catch(async () => {
|
||||
const photo = await fetchPhoto(url, index, identifier);
|
||||
|
||||
if (photo) {
|
||||
return photo;
|
||||
}
|
||||
|
||||
throw new Error('Photo not available');
|
||||
}), Promise.reject(new Error()));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -214,6 +222,8 @@ async function storePhotos(release, releaseId) {
|
||||
concurrency: 10,
|
||||
}).filter(photo => photo);
|
||||
|
||||
console.log(metaFiles);
|
||||
|
||||
const uniquePhotos = await filterHashDuplicates(metaFiles, 'releases', 'photo', `(${release.site.name}, ${releaseId}) "${release.title}"`);
|
||||
const savedPhotos = await savePhotos(uniquePhotos, release, releaseId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user