ripunzel/methods/eroshare.js

42 lines
1.1 KiB
JavaScript

'use strict';
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 => {
if(res.ok) {
return res.text()
}
return Promise.reject(`Unable to recover Eroshare video '${post.host.id}' :(`);
}).then(res => {
const $ = cheerio.load(res);
$('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
}]
};
*/
}).catch(error => {
console.log('\x1b[33m%s\x1b[0m', error);
});
};
module.exports = eroshare;