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,
|
||||
permalink: submission.permalink,
|
||||
url: submission.url,
|
||||
datetime: submission.created_utc * 1000,
|
||||
datetime: new Date(submission.created_utc * 1000),
|
||||
subreddit: submission.subreddit.display_name,
|
||||
host: dissectLink(submission.url)
|
||||
};
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
const util = require('util');
|
||||
const config = require('config');
|
||||
const fetch = require('node-fetch');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
function eroshare(post) {
|
||||
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}' :(`);
|
||||
}).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 {
|
||||
album: null,
|
||||
items: [{
|
||||
id: res.gfyItem.gfyName,
|
||||
url: res.gfyItem.webmUrl,
|
||||
title: res.gfyItem.title,
|
||||
description: res.gfyItem.description,
|
||||
type: 'video/webm',
|
||||
datetime: res.gfyItem.createDate * 1000,
|
||||
original: res.gfyItem
|
||||
}]
|
||||
album: {
|
||||
id: data.slug,
|
||||
title: data.title,
|
||||
datetime: new Date(data.created_at)
|
||||
},
|
||||
items: data.items.map(item => {
|
||||
return {
|
||||
id: item.slug,
|
||||
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 => {
|
||||
console.log('\x1b[33m%s\x1b[0m', error);
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ function gfycat(post) {
|
|||
title: res.gfyItem.title,
|
||||
description: res.gfyItem.description,
|
||||
type: 'video/webm',
|
||||
datetime: res.gfyItem.createDate * 1000,
|
||||
datetime: new Date(res.gfyItem.createDate * 1000),
|
||||
original: res.gfyItem
|
||||
}]
|
||||
};
|
||||
|
|
|
@ -16,16 +16,16 @@ function imgurAlbum(post) {
|
|||
url: res.data.link,
|
||||
title: res.data.title,
|
||||
description: res.data.description,
|
||||
datetime: res.data.datetime * 1000,
|
||||
datetime: new Date(res.data.datetime * 1000),
|
||||
original: res.data
|
||||
},
|
||||
items: res.data.images.map(item => ({
|
||||
id: item.id,
|
||||
url: item.link,
|
||||
url: item.animated ? item.mp4 : item.link,
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
type: item.animated ? 'video/mp4' : item.type,
|
||||
datetime: item.datetime * 1000,
|
||||
type: item.type,
|
||||
original: item
|
||||
}))
|
||||
};
|
||||
|
|
|
@ -14,11 +14,11 @@ function imgurImage(post) {
|
|||
album: null,
|
||||
items: [{
|
||||
id: res.data.id,
|
||||
url: res.data.link,
|
||||
url: res.data.animated ? res.data.mp4 : res.data.link,
|
||||
title: res.data.title,
|
||||
description: res.data.description,
|
||||
type: res.data.type,
|
||||
datetime: res.data.datetime * 1000,
|
||||
type: res.data.animated ? 'video/mp4' : res.data.type,
|
||||
datetime: new Date(res.data.datetime * 1000),
|
||||
original: res.data
|
||||
}]
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue