Skip to content

Commit

Permalink
Merge pull request #20 from abauzac/master
Browse files Browse the repository at this point in the history
Add facebook urls + fix stub setter
  • Loading branch information
dereuromark authored Aug 3, 2017
2 parents 7e1f61f + bc6aa81 commit 9f4a02f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MediaEmbed/Data/stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
'name' => 'Facebook',
'website' => 'https://www.facebook.com',
'url-match' => [
'https://www.facebook.com/[0-9a-z-_.]+/videos/([0-9]+)/'
'https://www.facebook.com/[0-9a-z-_.]+/videos/([0-9]+)/',
'https://www.facebook.com/[0-9a-zA-Z-_.]+/videos/(?:vb.\d+)/(\d+)/',
'https://www.facebook.com/[0-9a-zA-Z-_.]+/videos/(?:vl.\d+)/(\d+)/'
],
'embed-src' => '//www.facebook.com/video/embed?video_id=$2',
'embed-width' => '480',
Expand Down
3 changes: 3 additions & 0 deletions src/MediaEmbed/Object/MediaObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ public function stub($property = null, $value = null) {
if ($value === null) {
return isset($this->_stub[$property]) ? $this->_stub[$property] : null;
}
if(!empty($property) && !empty($value)){
$this->_stub[$property] = $value;
}
return $this;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/MediaEmbed/MediaEmbedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class MediaEmbedTest extends \PHPUnit_Framework_TestCase {
'http://youtu.be/MKlq4gQKtU0' => 'MKlq4gQKtU0',
'https://www.facebook.com/mega90er/videos/1309058692443747/' => '1309058692443747',
'https://www.facebook.com/diginights.HN/videos/1231155290281511/' => '1231155290281511',
'https://www.facebook.com/SkySports/videos/vb.10911153761/10153310275743762/?type=2&theater' => '10153310275743762',
'https://www.facebook.com/demotivateurFood/videos/vl.184872862011827/1034411179983244/?type=1' => '1034411179983244',
// Not yet possible
//'https://www.youtube.com/playlist?list=PLD1FA4687572EDB23' => 'PLD1FA4687572EDB23',

Expand Down

0 comments on commit 9f4a02f

Please sign in to comment.