Skip to content

Commit

Permalink
Support longer Facebook links
Browse files Browse the repository at this point in the history
  • Loading branch information
lukchojnicki@gmail.com authored and lukchojnicki@gmail.com committed Sep 19, 2019
1 parent f2124fa commit 9f9280d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/VideoPlatformsParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9f9280d

Please sign in to comment.