diff --git a/lib/embed.js b/lib/embed.js index de3c959..fb6fc15 100644 --- a/lib/embed.js +++ b/lib/embed.js @@ -40,7 +40,17 @@ const embeds = { image: ({src}) => ({ role: 'photo', URL: src - }) + }), + facebok: ({url, embedAs}) => { + const postUrl = embedAs === 'post' + ? url + : url.replace('/videos', '/posts'); + + return { + role: 'facebook_post', + URL: postUrl + }; + } }; const render = (item, opts) => { diff --git a/test/index.js b/test/index.js index bf81806..b36dedc 100644 --- a/test/index.js +++ b/test/index.js @@ -440,6 +440,18 @@ test('embeds', t => { type: 'embed', embedType: 'video', src: 'http://mic.com/video.gif' + }, + { + type: 'embed', + embedType: 'facebook', + embedAs: 'post', + src: 'https://www.facebook.com/MicMedia/posts/1985107918178655' + }, + { + type: 'embed', + embedType: 'facebook', + embedAs: 'video', + src: 'https://www.facebook.com/MicMedia/videos/1587772317999461/' } ] };