'use strict'; const fetch = require('node-fetch'); const $ = require('cheerio'); const mime = require('mime-types'); async function vidbleImage(host, post) { const res = await fetch(`https://vidble.com/${host.id}`); if (res.status !== 200) { throw new Error(`Could not fetch info for vidble album '${host.id}': '${res.error}'`); } const html = await res.text(); const resource = $('img', html).attr('src'); return { album: null, items: [{ id: host.id, url: `https://vidble.com/${resource}`, title: post ? post.title : null, datetime: post ? post.datetime : null, type: mime.lookup(resource), original: post || null, }], }; } module.exports = vidbleImage;