GizmodoBridge.php 1001 B

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