[FacebookBridge] Simplify implementation
This commit is contained in:
parent
68ee24d6bd
commit
5842bdfc83
1 changed files with 13 additions and 21 deletions
|
@ -577,32 +577,24 @@ EOD;
|
||||||
|
|
||||||
$content = $post->find('.userContentWrapper', 0);
|
$content = $post->find('.userContentWrapper', 0);
|
||||||
|
|
||||||
// Remove embedded videos (the preview image remains)
|
// This array specifies filters applied to all posts in order of appearance
|
||||||
foreach($content->find('._5mly') as $video) {
|
$content_filters = array(
|
||||||
$video->outertext = '';
|
'._5mly', // Remove embedded videos (the preview image remains)
|
||||||
}
|
'._2ezg', // Remove "Views ..."
|
||||||
|
'._59tj', // Remove origin information (i.e. "YOUTUBE.COM") from embedded media
|
||||||
|
'.hidden_elem', // Remove hidden elements (they are hidden anyway)
|
||||||
|
);
|
||||||
|
|
||||||
// Remove "Views ..."
|
foreach($content_filters as $filter) {
|
||||||
foreach($content->find('._2ezg') as $subject) {
|
foreach($content->find($filter) as $subject) {
|
||||||
$subject->outertext = '';
|
$subject->outertext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
// Change title tag for embedded media from anchor to paragraph
|
||||||
foreach($content->find('._3n1k') as $subject) {
|
foreach($content->find('._3n1k a') as $anchor) {
|
||||||
foreach($subject->find('a') as $anchor) {
|
|
||||||
$anchor->outertext = '<p>' . $anchor->innertext . '</p>';
|
$anchor->outertext = '<p>' . $anchor->innertext . '</p>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Remove hidden elements (they are hidden anyway)
|
|
||||||
foreach($content->find('.hidden_elem') as $subject) {
|
|
||||||
$subject->outertext = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = preg_replace(
|
$content = preg_replace(
|
||||||
'/(?i)><div class=\"_3dp([^>]+)>(.+?)div\ class=\"[^u]+userContent\"/i',
|
'/(?i)><div class=\"_3dp([^>]+)>(.+?)div\ class=\"[^u]+userContent\"/i',
|
||||||
|
|
Loading…
Reference in a new issue