1- const WATCH_RE = / ^ h t t p s ? : \/ \/ w w w \. f a c e b o o k \. c o m \/ w a t c h \/ ? \? (?: .+ & ) ? v = ( \d + ) / i;
2-
31export default {
42
53 re : [
@@ -8,123 +6,28 @@ export default {
86 / ^ h t t p s ? : \/ \/ ( w w w | m ) \. f a c e b o o k \. c o m \/ p e o p l e \/ [ ^ \/ ] + \/ \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 ( / c o n n e c t \. f a c e b o o k \. n e t \/ \w { 2 } _ \w { 2 } \/ s d k \. j s / 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 ( / d a t a \- s h o w \- p o s t s = \" (?: f a l s e | 0 ) ? \" / i, 'data-show-posts="true"' )
32- : html . replace ( / d a t a \- s h o w \- p o s t s = \" ( t r u e | 1 ) \" / i, 'data-show-posts="false"' ) ;
33-
34- html = options . getRequestOptions ( 'facebook.show_facepile' , false )
35- ? html . replace ( / d a t a \- s h o w \- f a c e p i l e = \" (?: f a l s e | 0 ) ? \" / i, 'data-show-facepile="true"' )
36- : html . replace ( / d a t a \- s h o w \- f a c e p i l e = \" ( t r u e | 1 ) \" / i, 'data-show-facepile="false"' ) ;
37-
38- html = options . getRequestOptions ( 'facebook.small_header' , false )
39- ? html . replace ( / d a t a \- s m a l l \- h e a d e r = \" (?: f a l s e | 0 ) ? \" / i, 'data-small-header="true"' )
40- : html . replace ( / d a t a \- s m a l l \- h e a d e r = \" ( t r u e | 1 ) \" / i, 'data-small-header="false"' ) ;
41-
42- var opts = {
43- show_posts : {
44- label : 'Show recent posts' ,
45- value : / d a t a \- s h o w \- p o s t s = " ( t r u e | 1 ) " / i. test ( html )
46- } ,
47- show_facepile : {
48- label : 'Show profile photos when friends like this' ,
49- value : / d a t a \- s h o w \- f a c e p i l e = " ( t r u e | 1 ) " / i. test ( html )
50- } ,
51- small_header : {
52- label : 'Use the small header instead' ,
53- value : / d a t a \- s m a l l \- h e a d e r = " ( t r u e | 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 ( / d a t a \- h e i g h t \= \" ( \d + ) \" / i, '' ) ;
71- html = options . getRequestOptions ( 'facebook.height' , oembed . height )
72- ? html . replace ( / d a t a \- s m a l l \- h e a d e r = \" / i, 'data-height="' + height + '" data-small-header="' )
73- : html . replace ( / d a t a \- h e i g h t \= \" ( \d + ) \" / i, '' ) ;
74- } else if ( / d a t a \- s m a l l \- h e a d e r = " ( t r u e | 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 && / \/ p r o f i l e \/ / . 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 ( / \/ p a g e s \/ / . 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