kuaidaiki_test.go 517 B

123456789101112131415161718192021222324
  1. package kuaidaili
  2. import (
  3. "fmt"
  4. "git.aionnect.com/hello-go/spider/common"
  5. "git.aionnect.com/hello-go/spider/spiders"
  6. "net/http"
  7. "testing"
  8. )
  9. func TestFreePagingSpider(t *testing.T) {
  10. // 从起始页开始执行爬虫
  11. params := &common.ProxyPagingParams{PagingNo: 1, Limit: 1000}
  12. startingUrl := fmt.Sprintf(TargetUrl, params.PagingNo)
  13. target := &common.Target{
  14. Key: KuaiDaiLi,
  15. Method: http.MethodGet,
  16. URL: startingUrl,
  17. Item: params,
  18. }
  19. spiders.Run(target,
  20. NewFreePagingSpider(),
  21. )
  22. }