Taobao.php 758 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Ku\Spider;
  3. use Dever;
  4. class Taobao
  5. {
  6. public function rule()
  7. {
  8. return array
  9. (
  10. 'pic' => '<img id="J_ImgBooth" src="(.*?)" data-hasZoom="700" data-size="400x400"/>',
  11. 'name' => '<h3 class="tb-main-title" data-title="(.*?)">',
  12. 'price' => '<input type="hidden" name="current_price" value= "(.*?)"/>',
  13. );
  14. }
  15. public function link($link)
  16. {
  17. $url = parse_url($link);
  18. parse_str($url['query'], $query);
  19. if (isset($query['id'])) {
  20. $id = $query['id'];
  21. $link = 'https://item.taobao.com/item.htm?id=' . $id;
  22. }
  23. return $link;
  24. }
  25. public function replace($key, $data)
  26. {
  27. return $data;
  28. }
  29. }