File tree Expand file tree Collapse file tree 2 files changed +53
-3
lines changed Expand file tree Collapse file tree 2 files changed +53
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Embed \Providers \OEmbed ;
4
4
5
+ use Embed \Adapters \Adapter ;
6
+ use Embed \Http \Response ;
5
7
use Embed \Http \Url ;
6
8
7
9
class Facebook extends EndPoint implements EndPointInterface
8
10
{
9
11
protected static $ pattern = 'www.facebook.com/* ' ;
12
+ protected $ key ;
13
+
14
+ /**
15
+ * {@inheritdoc}
16
+ */
17
+ public static function create (Adapter $ adapter )
18
+ {
19
+ $ key = $ adapter ->getConfig ('facebook[key] ' );
20
+
21
+ if (!empty ($ key )) {
22
+ return new static ($ adapter ->getResponse (), $ key );
23
+ }
24
+ }
25
+
26
+ /**
27
+ * {@inheritdoc}
28
+ */
29
+ protected function __construct (Response $ response , $ key = null )
30
+ {
31
+ $ this ->response = $ response ;
32
+ $ this ->key = $ key ;
33
+ }
10
34
11
35
/**
12
36
* {@inheritdoc}
13
37
*/
14
38
public function getEndPoint ()
15
39
{
16
40
if ($ this ->getUrl ()->match (['*/videos/* ' , '/video.php ' ])) {
17
- $ endPoint = Url::create ('https://www .facebook.com/plugins/video/oembed.json ' );
41
+ $ endPoint = Url::create ('https://graph .facebook.com/v8.0/oembed_video ' );
18
42
} else {
19
- $ endPoint = Url::create ('https://www .facebook.com/plugins/post/oembed.json ' );
43
+ $ endPoint = Url::create ('https://graph .facebook.com/v8.0/oembed_post ' );
20
44
}
21
45
22
46
return $ endPoint ->withQueryParameters ([
23
47
'url ' => (string ) $ this ->getUrl (),
24
48
'format ' => 'json ' ,
49
+ 'access_token ' => $ this ->key ,
25
50
]);
26
51
}
27
52
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace Embed \Providers \OEmbed ;
4
4
5
+ use Embed \Adapters \Adapter ;
6
+ use Embed \Http \Response ;
5
7
use Embed \Http \Url ;
6
8
7
9
class Instagram extends EndPoint implements EndPointInterface
@@ -11,7 +13,29 @@ class Instagram extends EndPoint implements EndPointInterface
11
13
'www.instagram.com/p/* ' ,
12
14
'instagr.am/p/* ' ,
13
15
];
14
- protected static $ endPoint = 'https://api.instagram.com/oembed ' ;
16
+ protected static $ endPoint = 'https://graph.facebook.com/v8.0/instagram_oembed ' ;
17
+ protected $ key ;
18
+
19
+ /**
20
+ * {@inheritdoc}
21
+ */
22
+ public static function create (Adapter $ adapter )
23
+ {
24
+ $ key = $ adapter ->getConfig ('facebook[key] ' );
25
+
26
+ if (!empty ($ key )) {
27
+ return new static ($ adapter ->getResponse (), $ key );
28
+ }
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ protected function __construct (Response $ response , $ key = null )
35
+ {
36
+ $ this ->response = $ response ;
37
+ $ this ->key = $ key ;
38
+ }
15
39
16
40
/**
17
41
* {@inheritdoc}
@@ -24,6 +48,7 @@ public function getEndPoint()
24
48
->withQueryParameters ([
25
49
'url ' => (string ) $ url ,
26
50
'format ' => 'json ' ,
51
+ 'access_token ' => $ this ->key ,
27
52
]);
28
53
}
29
54
}
You can’t perform that action at this time.
0 commit comments