Skip to content

Commit b70f3c0

Browse files
authored
Facebook pages are now retired (#609)
1 parent 4c2a8e2 commit b70f3c0

File tree

2 files changed

+20
-125
lines changed

2 files changed

+20
-125
lines changed

lib/plugins/system/oembed/providers.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@
4545
],
4646
"endpoint": "https://graph.facebook.com/v24.0/oembed_post"
4747
},
48-
{
49-
"name": "Facebook Page",
50-
"templates": [
51-
"(?:www|m)\\.facebook\\.com/(?:pg|pages)/",
52-
"(?:www|m)\\.facebook\\.com/[^/]+/?(?:about|photos|videos|events|timeline|photos_stream)?/?(?:\\?[^/\\?]+)?$"
53-
],
54-
"endpoint": "https://graph.facebook.com/v24.0/oembed_page"
55-
},
5648
{
5749
"name": "Instagram",
5850
"templates": [
Lines changed: 20 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
const WATCH_RE = /^https?:\/\/www\.facebook\.com\/watch\/?\?(?:.+&)?v=(\d+)/i;
2-
31
export default {
42

53
re: [
@@ -8,123 +6,28 @@ export default {
86
/^https?:\/\/(www|m)\.facebook\.com\/people\/[^\/]+\/\d+/i // for the "N/A" message only
97
],
108

11-
mixins: [
12-
"domain-icon",
13-
"og-image",
14-
"canonical",
15-
"og-description",
16-
"oembed-site",
17-
"og-title"
18-
// "fb-error" // Otherwise the HTTP redirect won't work for URLs like http://www.facebook.com/133065016766815_4376785445728063
19-
],
20-
21-
getLinks: function(oembed, url, meta, options) {
22-
23-
if (WATCH_RE.test(URL)) return; // Sometimes, for live videos it seems, HTML parser does not redirect to /user/video/ID and leave at /watch/?v=
24-
25-
var html = oembed.html.replace(/connect\.facebook\.net\/\w{2}_\w{2}\/sdk\.js/i,
26-
'connect.facebook.net/' + options.getProviderOptions('locale', 'en_US').replace('-', '_') + '/sdk.js');
27-
28-
var height = oembed.height;
29-
30-
html = options.getRequestOptions('facebook.show_posts', false)
31-
? html.replace(/data\-show\-posts=\"(?:false|0)?\"/i, 'data-show-posts="true"')
32-
: html.replace(/data\-show\-posts=\"(true|1)\"/i, 'data-show-posts="false"');
33-
34-
html = options.getRequestOptions('facebook.show_facepile', false)
35-
? html.replace(/data\-show\-facepile=\"(?:false|0)?\"/i, 'data-show-facepile="true"')
36-
: html.replace(/data\-show\-facepile=\"(true|1)\"/i, 'data-show-facepile="false"');
37-
38-
html = options.getRequestOptions('facebook.small_header', false)
39-
? html.replace(/data\-small\-header=\"(?:false|0)?\"/i, 'data-small-header="true"')
40-
: html.replace(/data\-small\-header=\"(true|1)\"/i, 'data-small-header="false"');
41-
42-
var opts = {
43-
show_posts: {
44-
label: 'Show recent posts',
45-
value: /data\-show\-posts="(true|1)"/i.test(html)
46-
},
47-
show_facepile: {
48-
label: 'Show profile photos when friends like this',
49-
value: /data\-show\-facepile="(true|1)"/i.test(html)
50-
},
51-
small_header: {
52-
label: 'Use the small header instead',
53-
value: /data\-small\-header="(true|1)"/i.test(html)
54-
}
55-
};
56-
57-
if (options.getRequestOptions('facebook.show_posts')) {
58-
height = options.getRequestOptions('facebook.height', height);
59-
60-
if (height < 70) {
61-
height = 70
62-
};
63-
64-
opts.height = {
65-
label: CONFIG.L.height,
66-
value: height,
67-
placeholder: 'ex.: 500, in px'
68-
};
69-
70-
html.replace(/data\-height\=\"(\d+)\"/i, '');
71-
html = options.getRequestOptions('facebook.height', oembed.height)
72-
? html.replace(/data\-small\-header=\"/i, 'data-height="' + height + '" data-small-header="')
73-
: html.replace(/data\-height\=\"(\d+)\"/i, '');
74-
} else if (/data\-small\-header="(true|1)"/i.test(html)){
75-
height = 70;
76-
} else {
77-
height = 130;
78-
}
79-
80-
return {
81-
type: CONFIG.T.text_html,
82-
rel: [CONFIG.R.app, CONFIG.R.ssl],
83-
html: html,
84-
options: opts,
85-
height: height
86-
};
87-
},
88-
89-
getData: function(oembedError, url, meta, options) {
90-
91-
if (WATCH_RE.test(URL)) return;
92-
93-
// Detect individual profiles (returns oEmbedError 400 as of Feb 4, 2023)
94-
// But fb://profile/ links are also used for pages like https://www.facebook.com/RhulFencing/, albeit no oEmbedError
95-
if (meta.ld?.person
96-
|| meta.al?.android?.url && /\/profile\//.test(meta.al.android.url)) {
97-
98-
return {
99-
message: "Facebook profile pages of individual users are not embeddable."
100-
};
101-
102-
// Detect unowned pages (returns oEmbedError 400 as of Feb 4, 2023)
103-
// Ex.: https://www.facebook.com/pages/Art-Friend-the-Curve/199296263568281
104-
} else if (/\/pages\//.test(meta.canonical || url)) {
105-
106-
return {
107-
message: "Unowned Facebook Pages are not supported."
108-
}
9+
getData: function(options, cb) {
10910

11+
// https://developers.facebook.com/blog/post/2025/04/08/oembed-updates/
12+
const msg = 'Facebook has retired automated page embeds on November 3, 2025.';
13+
14+
if (options.getProviderOptions('facebook.thumbnail', true)) {
15+
return cb({
16+
message: msg
17+
// and fall back to generic
18+
});
11019
} else {
111-
return {
112-
message : "This page cannot be embedded."
113-
}
20+
return cb({
21+
responseStatusCode: 415,
22+
message: msg
23+
// and do not fall back to generic
24+
});
11425
}
26+
}
11527

116-
},
117-
118-
tests: [
119-
"https://www.facebook.com/facebook",
120-
"https://www.facebook.com/hlaskyjanalasaka?fref=nf",
121-
// "https://www.facebook.com/pages/Art-Friend-the-Curve/199296263568281", // unowned
122-
"https://www.facebook.com/RhulFencing/",
123-
"https://www.facebook.com/caboreytours/",
124-
{
125-
noFeeds: true,
126-
skipMethods: ['getData'],
127-
skipMixins: ['og-image']
128-
}
129-
]
28+
// "https://www.facebook.com/facebook",
29+
// "https://www.facebook.com/hlaskyjanalasaka?fref=nf",
30+
// "https://www.facebook.com/pages/Art-Friend-the-Curve/199296263568281", // unowned
31+
// "https://www.facebook.com/RhulFencing/",
32+
// "https://www.facebook.com/caboreytours/"
13033
};

0 commit comments

Comments
 (0)