1
0

DansTonChatBridge.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * RssBridgeDansTonChat
  4. * Retrieve lastest quotes from DansTonChat.
  5. * Returns the most recent quotes, sorting by date (most recent first).
  6. * 2014-05-25
  7. *
  8. * @name DansTonChat Bridge
  9. * @homepage http://danstonchat.com/latest.html
  10. * @description Returns latest quotes from DansTonChat.
  11. * @maintainer Astalaseven
  12. */
  13. class DansTonChatBridge extends BridgeAbstract{
  14. public function collectData(array $param){
  15. $html = '';
  16. $link = 'http://danstonchat.com/latest.html';
  17. $html = file_get_html($link) or $this->returnError('Could not request DansTonChat.', 404);
  18. foreach($html->find('div.item') as $element) {
  19. $item = new \Item();
  20. $item->uri = $element->find('a', 0)->href;
  21. $item->title = 'DansTonChat '.$element->find('a', 1)->plaintext;
  22. $item->content = $element->find('a', 0)->innertext;
  23. $this->items[] = $item;
  24. }
  25. }
  26. public function getName(){
  27. return 'DansTonChat';
  28. }
  29. public function getURI(){
  30. return 'http://danstonchat.com';
  31. }
  32. public function getCacheDuration(){
  33. return 21600; // 6 hours
  34. }
  35. }