GizmodoBridge.php 967 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class GizmodoBridge extends FeedExpander {
  3. const MAINTAINER = "polopollo";
  4. const NAME = "Gizmodo";
  5. const URI = "http://gizmodo.com/";
  6. const CACHE_TIMEOUT = 1800; // 30min
  7. const DESCRIPTION = "Returns the newest posts from Gizmodo (full text).";
  8. protected function parseItem($item){
  9. $item = parent::parseItem($item);
  10. $articleHTMLContent = getSimpleHTMLDOMCached($item['uri']);
  11. if(!$articleHTMLContent){
  12. $text = 'Could not load '.$item['uri'];
  13. }else{
  14. $text = $articleHTMLContent->find('div.entry-content', 0)->innertext;
  15. foreach($articleHTMLContent->find('pagespeed_iframe') as $element) {
  16. $text .= '<p>link to a iframe (could be a video): <a href="'.$element->src.'">'.$element->src.'</a></p><br>';
  17. }
  18. $text = strip_tags($text, '<p><b><a><blockquote><img><em>');
  19. }
  20. $item['content'] = $text;
  21. return $item;
  22. }
  23. public function collectData(){
  24. $this->collectExpandableDatas('http://feeds.gawker.com/gizmodo/full');
  25. }
  26. }