From 9f9280d2201543c7161ed5be07dbbf2b422313b7 Mon Sep 17 00:00:00 2001 From: "lukchojnicki@gmail.com" Date: Thu, 19 Sep 2019 04:51:21 +0200 Subject: [PATCH] Support longer Facebook links --- src/VideoPlatformsParser.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/VideoPlatformsParser.php b/src/VideoPlatformsParser.php index 18709b5..bedf400 100644 --- a/src/VideoPlatformsParser.php +++ b/src/VideoPlatformsParser.php @@ -138,11 +138,13 @@ public function detectURL($url) ]; } else if (strpos($parsed_url['host'], 'facebook.com') !== false) { if (strpos($parsed_url['path'], '/videos/') !== false) { // #1 type link + if (empty($parsed_url['path'])) return false; if (empty(explode('/', $parsed_url['path'])[3])) return false; + $path = array_filter(explode('/', $parsed_url['path'])); return [ 'platform' => 'facebook', - 'id' => explode('/', $parsed_url['path'])[3] + 'id' => end($path) ]; } else if (strpos($parsed_url['path'], '/watch/') !== false) { // #2 type link if (empty($params_url['v'])) return false;