小优化

This commit is contained in:
xing 2022-08-27 21:30:14 +08:00
parent eb973a1942
commit e876fd0823

17
main.go
View File

@ -168,14 +168,17 @@ func (f *fetchHandler) handle(conn string) {
}
for _, sourceName := range (*f.searchSource.mapX)[conn] {
source := f.sourceMap[sourceName]
r := f.fetch2(source, key)
if r != nil && r.StatusCode == 200 {
if strings.ToUpper(source.Type) == "HTML" {
f.parsesDom(r, conn, source)
} else {
f.parseAjax(r, source, conn)
go func() {
r := f.fetch2(source, key)
if r != nil && r.StatusCode == 200 {
if strings.ToUpper(source.Type) == "HTML" {
f.parsesDom(r, conn, source)
} else {
f.parseAjax(r, source, conn)
}
}
}
}()
}
}