Tiejiong.php 868 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace console\models\spider;
  3. class Tiejiong extends SpiderAbstract
  4. {
  5. protected function filterContent($content = '')
  6. {
  7. // 只要需要的内容
  8. preg_match('#([\s\S]*?)<div class=\"jiathis_style_32x32\"#', $content, $match);
  9. $content = $match[1];
  10. // 图片全路径
  11. $content = preg_replace('#<img([\s\S]+?)src=\"(.*?)\"#', '<img$1src="'.$this->config['domain'].'$2"', $content);
  12. // 去除链接
  13. $content = preg_replace('#<a([\s\S]+?)>(.*)?</a>#', '$2', $content);
  14. return $content;
  15. }
  16. protected function getCover($listNode)
  17. {
  18. $cover = strpos($listNode->filter('img')->attr('src'), 'http') === false ? $this->config['domain'].$listNode->filter('img')->attr('src') : $listNode->filter('img')->attr('src');
  19. return $cover;
  20. }
  21. }