Skip to content

Commit

Permalink
domains: handle FB reels through a plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
iparamonau committed Jul 23, 2024
1 parent 50d5f39 commit f70cdb7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/domains/facebook.com/facebook.video.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@ export default {
/^https?:\/\/(?:www|business)\.facebook\.com\/video\.php.*[\?&]v=(\d+)(?:$|&)/i,
/^https?:\/\/(?:www|business)\.facebook\.com\/video\.php.*[\?&]id=(\d+)(?:$|&)/i,
/^https?:\/\/(?:www|business)\.facebook\.com\/[a-zA-Z0-9\.]+\/videos\/(?:[a-zA-Z0-9\-]+\/)?(\d+)/i,
/^https?:\/\/(?:www|business)\.facebook\.com\/watch\/?\?(?:.+&)?v=(\d+)/i
/^https?:\/\/(?:www|business)\.facebook\.com\/watch\/?\?(?:.+&)?v=(\d+)/i,
/^https?:\/\/(?:www|business)\.facebook\.com\/reel\/(\d+)/i
],

mixins: ["fb-error"],

getLink: function(url, oembed, options) {

if (/^https:\/\/(?:www\.)?instagram\.com/i.test(oembed.author_url)) {
return {
message: "This video can't be embedded because it may contain content owned by someone else."
}
}

var html = oembed.html.replace(/connect\.facebook\.net\/\w{2}_\w{2}\/sdk\.js/i,
'connect.facebook.net/' + options.getProviderOptions('locale', 'en_US').replace('-', '_') + '/sdk.js');

Expand Down

0 comments on commit f70cdb7

Please sign in to comment.