/* Embed.providerName.getData should return an object with the following properties: - title - description - thumbnailUrl - sourceName - sourceUrl - media (object) */ import Embed from '../../modules/embed.js'; // import Metascraper from 'metascraper'; Embed.builtin = { getData(url) { // const metadata = await Metascraper.scrapeUrl(url); const metadata = extractMeta(url); return { title: metadata.title, description: metadata.description, thumbnailUrl: metadata.image, } } } // -------------- // // adapted from https://github.com/acemtp/meteor-meta-extractor/blob/master/meta-extractor.js import he from 'he'; const extractMeta = function (params) { var html; var match; var META = {}; if (params.substr(0, 4) === 'http') { try { var result = HTTP.call('GET', params); if (result.statusCode !== 200) { return META; } html = result.content; } catch (e) { console.log('catch error', e); return META; } } else { html = params; } // search for a