Added draft Eroshare archive support. Methods return date objects instead of Unix timestamp strings.
This commit is contained in:
parent
91e47ffbb0
commit
3cd1737037
|
@ -12,7 +12,7 @@ function curate(submissions) {
|
||||||
user: submission.author.name,
|
user: submission.author.name,
|
||||||
permalink: submission.permalink,
|
permalink: submission.permalink,
|
||||||
url: submission.url,
|
url: submission.url,
|
||||||
datetime: submission.created_utc * 1000,
|
datetime: new Date(submission.created_utc * 1000),
|
||||||
subreddit: submission.subreddit.display_name,
|
subreddit: submission.subreddit.display_name,
|
||||||
host: dissectLink(submission.url)
|
host: dissectLink(submission.url)
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const cheerio = require('cheerio');
|
|
||||||
|
|
||||||
function eroshare(post) {
|
function eroshare(post) {
|
||||||
return fetch(`https://web.archive.org/web/20170630040157im_/https://eroshare.com/${post.host.id}`).then(res => {
|
return fetch(`https://web.archive.org/web/20170630040157im_/https://eroshare.com/${post.host.id}`).then(res => {
|
||||||
|
@ -13,26 +12,28 @@ function eroshare(post) {
|
||||||
|
|
||||||
return Promise.reject(`Unable to recover Eroshare video '${post.host.id}' :(`);
|
return Promise.reject(`Unable to recover Eroshare video '${post.host.id}' :(`);
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
const $ = cheerio.load(res);
|
const data = JSON.parse(res.match(/var album = .*/)[0].slice(12, -1));
|
||||||
|
|
||||||
$('video').forEach(video => {
|
|
||||||
console.log(video);
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
return {
|
return {
|
||||||
album: null,
|
album: {
|
||||||
items: [{
|
id: data.slug,
|
||||||
id: res.gfyItem.gfyName,
|
title: data.title,
|
||||||
url: res.gfyItem.webmUrl,
|
datetime: new Date(data.created_at)
|
||||||
title: res.gfyItem.title,
|
},
|
||||||
description: res.gfyItem.description,
|
items: data.items.map(item => {
|
||||||
type: 'video/webm',
|
return {
|
||||||
datetime: res.gfyItem.createDate * 1000,
|
id: item.slug,
|
||||||
original: res.gfyItem
|
url: item.type === 'Image' ? item.url_full_protocol : item.url_mp4,
|
||||||
}]
|
title: data.title,
|
||||||
|
description: item.description,
|
||||||
|
type: item.type === 'Image' ? 'image/jpeg' : 'video/mp4',
|
||||||
|
datetime: new Date(data.created_at),
|
||||||
|
width: data.width,
|
||||||
|
height: data.height,
|
||||||
|
original: item
|
||||||
|
};
|
||||||
|
})
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log('\x1b[33m%s\x1b[0m', error);
|
console.log('\x1b[33m%s\x1b[0m', error);
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@ function gfycat(post) {
|
||||||
title: res.gfyItem.title,
|
title: res.gfyItem.title,
|
||||||
description: res.gfyItem.description,
|
description: res.gfyItem.description,
|
||||||
type: 'video/webm',
|
type: 'video/webm',
|
||||||
datetime: res.gfyItem.createDate * 1000,
|
datetime: new Date(res.gfyItem.createDate * 1000),
|
||||||
original: res.gfyItem
|
original: res.gfyItem
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,16 +16,16 @@ function imgurAlbum(post) {
|
||||||
url: res.data.link,
|
url: res.data.link,
|
||||||
title: res.data.title,
|
title: res.data.title,
|
||||||
description: res.data.description,
|
description: res.data.description,
|
||||||
datetime: res.data.datetime * 1000,
|
datetime: new Date(res.data.datetime * 1000),
|
||||||
original: res.data
|
original: res.data
|
||||||
},
|
},
|
||||||
items: res.data.images.map(item => ({
|
items: res.data.images.map(item => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
url: item.link,
|
url: item.animated ? item.mp4 : item.link,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
description: item.description,
|
description: item.description,
|
||||||
|
type: item.animated ? 'video/mp4' : item.type,
|
||||||
datetime: item.datetime * 1000,
|
datetime: item.datetime * 1000,
|
||||||
type: item.type,
|
|
||||||
original: item
|
original: item
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,11 +14,11 @@ function imgurImage(post) {
|
||||||
album: null,
|
album: null,
|
||||||
items: [{
|
items: [{
|
||||||
id: res.data.id,
|
id: res.data.id,
|
||||||
url: res.data.link,
|
url: res.data.animated ? res.data.mp4 : res.data.link,
|
||||||
title: res.data.title,
|
title: res.data.title,
|
||||||
description: res.data.description,
|
description: res.data.description,
|
||||||
type: res.data.type,
|
type: res.data.animated ? 'video/mp4' : res.data.type,
|
||||||
datetime: res.data.datetime * 1000,
|
datetime: new Date(res.data.datetime * 1000),
|
||||||
original: res.data
|
original: res.data
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue