1
0

Rule34pahealBridge.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * RssBridgeRule34paheal
  4. * Returns images from given page
  5. * 2014-05-25
  6. *
  7. * @name Rule34paheal
  8. * @homepage http://rule34.paheal.net/
  9. * @description Returns images from given page
  10. * @maintainer mitsukarenai
  11. * @use1(p="page",t='tags")
  12. */
  13. class Rule34pahealBridge extends BridgeAbstract{
  14. public function collectData(array $param){
  15. $page = 0;$tags='';
  16. if (isset($param['p'])) {
  17. $page = (int)preg_replace("/[^0-9]/",'', $param['p']);
  18. }
  19. if (isset($param['t'])) {
  20. $tags = urlencode($param['t']);
  21. }
  22. $html = file_get_html("http://rule34.paheal.net/post/list/$tags/$page") or $this->returnError('Could not request Rule34paheal.', 404);
  23. foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) {
  24. $item = new \Item();
  25. $item->uri = 'http://rule34.paheal.net'.$element->find('a', 0)->href;
  26. $item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
  27. $item->timestamp = time();
  28. $item->thumbnailUri = $element->find('img', 0)->src;
  29. $item->tags = $element->getAttribute('data-tags');
  30. $item->title = 'Rule34paheal | '.$item->postid;
  31. $item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;
  32. $this->items[] = $item;
  33. }
  34. }
  35. public function getName(){
  36. return 'Rule34paheal';
  37. }
  38. public function getURI(){
  39. return 'http://rule34.paheal.net/';
  40. }
  41. public function getCacheDuration(){
  42. return 1800; // 30 minutes
  43. }
  44. }