ripunzel/methods/gfycat.js

27 lines
736 B
JavaScript
Raw Normal View History

'use strict';
const util = require('util');
const config = require('config');
const fetch = require('node-fetch');
function gfycat(post) {
return fetch(`https://gfycat.com/cajax/get/${post.host.id}`).then(res => res.json()).then(res => {
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.error(error);
});
};
module.exports = gfycat;