Fixed obsolete eroshare extract single album item property. Throwing error when imgur album and image info fetch fails. Main catch method console log colored red.
This commit is contained in:
@@ -13,7 +13,7 @@ function eroshare(post) {
|
||||
return Promise.reject(`Unable to recover Eroshare video '${post.host.id}' :(`);
|
||||
}).then(res => {
|
||||
const data = JSON.parse(res.match(/var album = .*/)[0].slice(12, -1));
|
||||
const extract = config.patterns.album.extractSingleItem && data.items.length === 1;
|
||||
const extract = config.library.album.extractSingleItem && data.items.length === 1;
|
||||
|
||||
return {
|
||||
album: extract ? null : {
|
||||
|
||||
@@ -10,6 +10,10 @@ function imgurAlbum(post) {
|
||||
'Authorization': `Client-ID ${config.methods.imgur.clientId}`
|
||||
}
|
||||
}).then(res => res.json()).then(res => {
|
||||
if(!res.ok) {
|
||||
throw new Error(`Could not fetch info for imgur album '${post.host.id}': ${res.data.error}`);
|
||||
}
|
||||
|
||||
const extract = config.library.album.extractSingleItem && res.data.images.length === 1;
|
||||
|
||||
if(extract) {
|
||||
@@ -37,7 +41,7 @@ function imgurAlbum(post) {
|
||||
}))
|
||||
};
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
return console.log('\x1b[31m%s\x1b[0m', error);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ function imgurImage(post) {
|
||||
'Authorization': `Client-ID ${config.methods.imgur.clientId}`
|
||||
}
|
||||
}).then(res => res.json()).then(res => {
|
||||
if(!res.ok) {
|
||||
throw new Error(`Could not fetch info for imgur image '${post.host.id}': ${res.data.error}`);
|
||||
}
|
||||
|
||||
return {
|
||||
album: null,
|
||||
items: [{
|
||||
@@ -23,7 +27,7 @@ function imgurImage(post) {
|
||||
}]
|
||||
};
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
return console.log('\x1b[31m%s\x1b[0m', error);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user