From fad4a7f0b3598bb31945e8e773ff9ea49a33d516 Mon Sep 17 00:00:00 2001 From: Prem Kumar Kailasu Date: Tue, 6 Sep 2016 14:07:11 +0800 Subject: [PATCH 1/2] Update facebook video embed regular expression to match all users videos --- src/Pass/FacebookNonIframeTransformPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pass/FacebookNonIframeTransformPass.php b/src/Pass/FacebookNonIframeTransformPass.php index 3750f812..392694b8 100644 --- a/src/Pass/FacebookNonIframeTransformPass.php +++ b/src/Pass/FacebookNonIframeTransformPass.php @@ -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'; From e13d1d4f8bee667887c0694365ba2b558fd611dc Mon Sep 17 00:00:00 2001 From: Prem Kumar Kailasu Date: Fri, 9 Sep 2016 15:03:06 +0800 Subject: [PATCH 2/2] Added test case for other users videos --- .../fragment-html/facebook-non-iframe-fragment.html | 7 +++++++ .../facebook-non-iframe-fragment.html.out | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/tests/test-data/fragment-html/facebook-non-iframe-fragment.html b/tests/test-data/fragment-html/facebook-non-iframe-fragment.html index efd69dbb..87955db7 100644 --- a/tests/test-data/fragment-html/facebook-non-iframe-fragment.html +++ b/tests/test-data/fragment-html/facebook-non-iframe-fragment.html @@ -23,4 +23,11 @@

How to share with just friends.

Posted by Facebook on Friday, 5 December 2014 + + +
+
+ Live from our Townhall Q&A in Rome. Comment to ask a question! +

Live from our Townhall Q&A in Rome. Comment to ask a question!

Posted by Mark Zuckerberg on Monday, August 29, 2016 +
\ No newline at end of file diff --git a/tests/test-data/fragment-html/facebook-non-iframe-fragment.html.out b/tests/test-data/fragment-html/facebook-non-iframe-fragment.html.out index f14d6b5c..498795df 100644 --- a/tests/test-data/fragment-html/facebook-non-iframe-fragment.html.out +++ b/tests/test-data/fragment-html/facebook-non-iframe-fragment.html.out @@ -5,6 +5,8 @@ + + ORIGINAL HTML --------------- Line 1:
@@ -33,6 +35,13 @@ Line 23:

How to share with just friends.

Posted by +Line 29:
+Line 30: Live from our Townhall Q&A in Rome. Comment to ask a question! +Line 31:

Live from our Townhall Q&A in Rome. Comment to ask a question!

Posted by Mark Zuckerberg on Monday, August 29, 2016 +Line 32:
+Line 33: Transformations made from HTML tags to AMP custom tags @@ -47,6 +56,9 @@ Transformations made from HTML tags to AMP custom tags
at line 20 ACTION TAKEN: div.fb-video facebook javascript sdk embed code was converted to the amp-facebook tag. +
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 -------------------------------------