diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index 081cd2a5..b485f084 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -100,6 +100,11 @@ class TwitterBridge extends BridgeAbstract { continue; } + // remove 'invisible' content + foreach($tweet->find('.invisible') as $invisible){ + $invisible->outertext = ''; + } + $item = array(); // extract username and sanitize $item['username'] = $tweet->getAttribute('data-screen-name'); @@ -116,13 +121,7 @@ class TwitterBridge extends BridgeAbstract { // extract tweet timestamp $item['timestamp'] = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time'); // generate the title - $item['title'] = strip_tags( - html_entity_decode( - $tweet->find('p.js-tweet-text', 0)->innertext, - ENT_QUOTES, - 'UTF-8' - ) - ); + $item['title'] = $this->fixAnchorSpacing(strip_tags($tweet->find('p.js-tweet-text', 0), '')); $this->processContentLinks($tweet); $this->processEmojis($tweet); @@ -134,6 +133,9 @@ class TwitterBridge extends BridgeAbstract { $tweet->find('p.js-tweet-text', 0)->innertext ); + // fix anchors missing spaces in-between + $cleanedTweet = $this->fixAnchorSpacing($cleanedTweet); + // Add picture to content $picture_html = ''; if(!$hidePictures){ @@ -245,6 +247,15 @@ EOD; } } + private function fixAnchorSpacing($content){ + // fix anchors missing spaces in-between + return str_replace( + 'find('div.AdaptiveMedia-container', 0);