Added single item album extraction with configurable display variable, as well as a host/source name variable.
This commit is contained in:
@@ -13,15 +13,17 @@ 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;
|
||||
|
||||
return {
|
||||
album: {
|
||||
album: extract ? null : {
|
||||
id: data.slug,
|
||||
title: data.title,
|
||||
datetime: new Date(data.created_at)
|
||||
},
|
||||
items: data.items.map(item => {
|
||||
return {
|
||||
extracted: extract,
|
||||
id: item.slug,
|
||||
url: item.type === 'Image' ? item.url_full_protocol : item.url_mp4,
|
||||
title: data.title,
|
||||
|
||||
@@ -10,8 +10,10 @@ function imgurAlbum(post) {
|
||||
'Authorization': `Client-ID ${config.methods.imgur.clientId}`
|
||||
}
|
||||
}).then(res => res.json()).then(res => {
|
||||
const extract = config.patterns.album.extractSingleItem && res.data.images.length === 1;
|
||||
|
||||
return {
|
||||
album: {
|
||||
album: extract ? null : {
|
||||
id: res.data.id,
|
||||
url: res.data.link,
|
||||
title: res.data.title,
|
||||
@@ -20,10 +22,11 @@ function imgurAlbum(post) {
|
||||
original: res.data
|
||||
},
|
||||
items: res.data.images.map(item => ({
|
||||
extracted: extract,
|
||||
id: item.id,
|
||||
url: item.animated ? item.mp4 : item.link,
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
title: item.title || (extract ? res.data.title : null),
|
||||
description: item.description || (extract ? res.data.description : null),
|
||||
type: item.animated ? 'video/mp4' : item.type,
|
||||
datetime: item.datetime * 1000,
|
||||
original: item
|
||||
|
||||
Reference in New Issue
Block a user