mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
- 新增 BrowserPool 结构和相关方法,用于管理和复用浏览器实例 - 在 CrawlerApi 中集成浏览器池,使用 FetchPage 方法获取页面内容 -优化了配置获取方式,统一使用 GetConfig() 函数 -修复了一些代码中的小问题,如错误处理和日志记录
19 lines
372 B
Go
19 lines
372 B
Go
package data
|
|
|
|
import (
|
|
"go-stock/backend/db"
|
|
"testing"
|
|
)
|
|
|
|
func TestPool(t *testing.T) {
|
|
db.Init("../../data/stock.db")
|
|
|
|
pool := NewBrowserPool(1)
|
|
go pool.FetchPage("https://fund.eastmoney.com/016533.html", "body")
|
|
go pool.FetchPage("https://fund.eastmoney.com/217021.html", "body")
|
|
go pool.FetchPage("https://fund.eastmoney.com/001125.html", "body")
|
|
|
|
select {}
|
|
|
|
}
|