NextInpactBridge.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. class NextInpactBridge extends FeedExpander {
  3. const MAINTAINER = 'qwertygc';
  4. const NAME = 'NextInpact Bridge';
  5. const URI = 'https://www.nextinpact.com/';
  6. const DESCRIPTION = 'Returns the newest articles.';
  7. public function collectData(){
  8. $this->collectExpandableDatas(self::URI . 'rss/news.xml', 10);
  9. }
  10. protected function parseItem($newsItem){
  11. $item = parent::parseItem($newsItem);
  12. $item['content'] = $this->extractContent($item['uri']);
  13. return $item;
  14. }
  15. private function extractContent($url){
  16. $html2 = getSimpleHTMLDOMCached($url);
  17. $text = '<p><em>'
  18. . $html2->find('span.sub_title', 0)->innertext
  19. . '</em></p><p><img src="'
  20. . $html2->find('div.container_main_image_article', 0)->find('img.dedicated', 0)->src
  21. . '" alt="-" /></p><div>'
  22. . $html2->find('div[itemprop=articleBody]', 0)->innertext
  23. . '</div>';
  24. $premium_article = $html2->find('h2.title_reserve_article', 0);
  25. if (is_object($premium_article))
  26. $text = $text . '<p><em>' . $premium_article->innertext . '</em></p>';
  27. return $text;
  28. }
  29. }