Added case for ripping base64 images

master
Edward Peterson 3 years ago
parent a06613cd2e
commit 0c28b9edf3

@ -89,6 +89,7 @@ async function run(url, processor) {
console.log('Done collecting URLS', galleryUrls.length);
const payloads = await Promise.all(galleryUrls.map(image => new Promise(async (resolve, reject) => {
if(image.url) {
superagent.get(image.url).responseType('blob').then(function (response) {
if (response.statusCode == 200) {
console.log('Resolving', image.url)
@ -110,6 +111,17 @@ async function run(url, processor) {
console.error(error)
resolve({})
});
} else if (image.base64){
return resolve({
response: {
content: {
mimeType: response.headers["content-type"],
encoding: 'base64',
text: image.base64
}
}
});
}
})))
console.log('URLS done downloading')
await browser.close();

Loading…
Cancel
Save