|
@@ -22,7 +22,6 @@ func NewVM(attachesDir string, dnf be.EventNotifyFace) *VM {
|
|
|
// RunSpider
|
|
|
func (vm *VM) RunSpider(url string, maxPages int, listDealy int64, contentDelay int64, headless bool, showImage bool, proxyServe string, exit chan bool, cssMark map[string]interface{}) {
|
|
|
sc, err := be.NewSpiderConfig(cssMark)
|
|
|
- qu.Debug("sc---", *sc)
|
|
|
if err != nil {
|
|
|
qu.Debug("标注信息传输失败!")
|
|
|
vm.dnf.Dispatch("debug_event", "标注信息传输失败!")
|
|
@@ -54,7 +53,7 @@ func (vm *VM) RunSpider(url string, maxPages int, listDealy int64, contentDelay
|
|
|
if runJs == "" {
|
|
|
runJs = renderJavascriptCoder(loadListItemsJS, sc)
|
|
|
}
|
|
|
- //qu.Debug("execute list jscode", runJs)
|
|
|
+ qu.Debug("execute list jscode", runJs)
|
|
|
err = chromedp.Run(ctx, chromedp.Tasks{
|
|
|
chromedp.Evaluate(runJs, &listResult),
|
|
|
})
|
|
@@ -73,12 +72,13 @@ func (vm *VM) RunSpider(url string, maxPages int, listDealy int64, contentDelay
|
|
|
}
|
|
|
currentResult := list.New()
|
|
|
be.DataResults[sc.Code] = currentResult
|
|
|
- //qu.Debug("execute content js", runJs)
|
|
|
+ qu.Debug("execute content js", runJs)
|
|
|
for _, v := range listResult {
|
|
|
select {
|
|
|
case <-exit:
|
|
|
return
|
|
|
default:
|
|
|
+ qu.Debug(v.No, v.ListTitle, v.Href)
|
|
|
vm.dnf.Dispatch("debug_event", fmt.Sprintf("4. %d- 待 下载详情页 %s ", v.No, v.ListTitle))
|
|
|
var result string = ""
|
|
|
err = chromedp.Run(ctx, chromedp.Tasks{
|