[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
This commit is contained in:
logmanoriginal 2018-11-08 18:06:51 +01:00
parent 0b792d77eb
commit 7026684e34

View file

@ -577,10 +577,17 @@ EOD;
$content = $post->find('.userContentWrapper', 0);
$content = preg_replace(
'/(?i)><div class=\"_59tj([^>]+)>(.+?)<\/div><\/div><a/i',
'',
$content);
// Remove origin information (i.e. "YOUTUBE.COM") from embedded media
foreach($content->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 = '<p>' . $anchor->innertext . '</p>';
}
}
$content = preg_replace(
'/(?i)><div class=\"_3dp([^>]+)>(.+?)div\ class=\"[^u]+userContent\"/i',