Skip to content

Commit

Permalink
Merge pull request #136 from pkailasusph/master
Browse files Browse the repository at this point in the history
Update facebook video embed regular expression to match all users videos
  • Loading branch information
sebastianbenz authored Sep 9, 2016
2 parents fd76239 + e13d1d4 commit 438f3fd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Pass/FacebookNonIframeTransformPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function getFacebookEmbedAttrs(DOMQuery $el)

$card = true;
// e.g https://www.facebook.com/facebook/videos/10153231379946729/
if (preg_match('&(*UTF8)facebook\.com/facebook/videos/\d+/?&i', $src)) {
if (preg_match('&(*UTF8)facebook\.com/.*/videos/\d+/?&i', $src)) {
// A facebook video can be embedded as a post. Doing that enables the video "card" to display
if ($el->attr('data-show-text') !== "false") {
$embed_as = 'post';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@
<p>How to share with just friends.</p>Posted by <a href="https://www.facebook.com/facebook/">Facebook</a> on
Friday, 5 December 2014
</blockquote>
</div>

<div class="fb-video" data-href="https://www.facebook.com/zuck/videos/10103066366848051/" data-width="500" data-show-text="false">
<blockquote cite="https://www.facebook.com/zuck/videos/10103066366848051/" class="fb-xfbml-parse-ignore">
<a href="https://www.facebook.com/zuck/videos/10103066366848051/">Live from our Townhall Q&amp;A in Rome. Comment to ask a question!</a>
<p>Live from our Townhall Q&amp;A in Rome. Comment to ask a question!</p>Posted by <a href="https://www.facebook.com/zuck">Mark Zuckerberg</a> on Monday, August 29, 2016
</blockquote>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

<amp-facebook layout="responsive" data-href="https://www.facebook.com/facebook/videos/10153231379946729/" data-embed-as="post" height="366" width="500"></amp-facebook>

<amp-facebook layout="responsive" data-href="https://www.facebook.com/zuck/videos/10103066366848051/" data-embed-as="video" height="366" width="500"></amp-facebook>

ORIGINAL HTML
---------------
Line 1: <div id="fb-root"></div>
Expand Down Expand Up @@ -33,6 +35,13 @@ Line 23: <p>How to share with just friends.</p>Posted by <a href="https:
Line 24: Friday, 5 December 2014
Line 25: </blockquote>
Line 26: </div>
Line 27:
Line 28: <div class="fb-video" data-href="https://www.facebook.com/zuck/videos/10103066366848051/" data-width="500" data-show-text="false">
Line 29: <blockquote cite="https://www.facebook.com/zuck/videos/10103066366848051/" class="fb-xfbml-parse-ignore">
Line 30: <a href="https://www.facebook.com/zuck/videos/10103066366848051/">Live from our Townhall Q&amp;A in Rome. Comment to ask a question!</a>
Line 31: <p>Live from our Townhall Q&amp;A in Rome. Comment to ask a question!</p>Posted by <a href="https://www.facebook.com/zuck">Mark Zuckerberg</a> on Monday, August 29, 2016
Line 32: </blockquote>
Line 33: </div>


Transformations made from HTML tags to AMP custom tags
Expand All @@ -47,6 +56,9 @@ Transformations made from HTML tags to AMP custom tags
<div class="fb-video" data-href="https://www.facebook.com/facebook/videos/10153231379946729/" data-width="500" data-show-text="true"> at line 20
ACTION TAKEN: div.fb-video facebook javascript sdk embed code was converted to the amp-facebook tag.

<div class="fb-video" data-href="https://www.facebook.com/zuck/videos/10103066366848051/" data-width="500" data-show-text="false"> at line 28
ACTION TAKEN: div.fb-video facebook javascript sdk embed code was converted to the amp-facebook tag.


AMP-HTML Validation Issues and Fixes
-------------------------------------
Expand Down

0 comments on commit 438f3fd

Please sign in to comment.