From 7026684e34b5e62696a50bc65018edf9df475454 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Thu, 8 Nov 2018 18:06:51 +0100 Subject: [PATCH] [FacebookBridge] Don't remove description of embedded media FB includes origin information (i.e. "YOUTUBE.COM") as well as descriptions with embedded media (images and video). These details are currently being removed by the bridge. This commit changes implementation to only remove origin information and keep the media description in place. The media description consists of two elements - title and description. The title provided by FB is included in an anchor, which gets replaced by a paragraph with the same contents to improve readability. References #912 --- bridges/FacebookBridge.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index cb5be725..cd5898e4 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -577,10 +577,17 @@ EOD; $content = $post->find('.userContentWrapper', 0); - $content = preg_replace( - '/(?i)>
]+)>(.+?)<\/div><\/div>find('._59tj') as $subject) { + $subject->outertext = ''; + } + + // Change title tag for embedded media from anchor to paragraph + foreach($content->find('._3n1k') as $subject) { + foreach($subject->find('a') as $anchor) { + $anchor->outertext = '

' . $anchor->innertext . '

'; + } + } $content = preg_replace( '/(?i)>
]+)>(.+?)div\ class=\"[^u]+userContent\"/i',