GizmodoBridge.php 996 B

123456789101112131415161718192021222324252627282930313233343536
  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="'
  17. . $element->src
  18. . '">'
  19. . $element->src
  20. . '</a></p><br>';
  21. }
  22. $text = strip_tags($text, '<p><b><a><blockquote><img><em>');
  23. }
  24. $item['content'] = $text;
  25. return $item;
  26. }
  27. public function collectData(){
  28. $this->collectExpandableDatas('http://feeds.gawker.com/gizmodo/full');
  29. }
  30. }