Skip to content

Commit 70245b9

Browse files
committed
修复AQC经常触发验证问题 fix #131 #121
1 parent 9bb2dda commit 70245b9

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

internal/aiqicha/aiqicha.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,24 @@ type AQC struct {
2121
// AdvanceFilter 筛选过滤
2222
func (h *AQC) AdvanceFilter() ([]gjson.Result, error) {
2323
name := h.Options.KeyWord
24-
//urls := "https://aiqicha.baidu.com/s?q=" + urlTool.QueryEscape(name) + "&t=0"
25-
urls := "https://aiqicha.baidu.com/s/advanceFilterAjax?q=" + urlTool.QueryEscape(name) + "&p=1&s=10&f={}"
24+
urls := "https://aiqicha.baidu.com/s?q=" + urlTool.QueryEscape(name) + "&t=0"
25+
//urls := "https://aiqicha.baidu.com/s/advanceFilterAjax?q=" + urlTool.QueryEscape(name) + "&p=1&s=10&f={}"
2626
content := GetReq(urls, h.Options)
2727
content = strings.ReplaceAll(content, "<em>", "⌈")
2828
content = strings.ReplaceAll(content, "<\\/em>", "⌋")
29-
//rq := pageParseJson(content)
30-
enList := gjson.Get(content, "data.resultList").Array()
31-
ddw := gjson.Get(content, "ddw").Int()
29+
rq, _ := pageParseJson(content)
30+
enList := rq.Get("resultList").Array()
31+
//enList := gjson.Get(content, "data.resultList").Array()
3232
if len(enList) == 0 {
3333
gologger.Debug().Str("查询请求", name).Msg(content)
3434
return enList, fmt.Errorf("【AQC】没有查询到关键词 ⌈%s⌋", name)
3535
}
3636
// advanceFilterAjax 接口特殊处理
37-
for i, v := range enList {
38-
s, _ := sjson.Set(v.Raw, "pid", transformNumber(v.Get("pid").String(), ddw))
39-
enList[i] = gjson.Parse(s)
40-
}
37+
//ddw := gjson.Get(content, "ddw").Int()
38+
//for i, v := range enList {
39+
// s, _ := sjson.Set(v.Raw, "pid", transformNumber(v.Get("pid").String(), ddw))
40+
// enList[i] = gjson.Parse(s)
41+
//}
4142
return enList, nil
4243
}
4344

internal/aiqicha/bean.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package aiqicha
22

33
import (
4+
"crypto/tls"
45
"fmt"
56
"github.com/go-resty/resty/v2"
67
"github.com/tidwall/gjson"
@@ -97,6 +98,7 @@ func getENMap() map[string]*common.EnsGo {
9798

9899
func GetReq(url string, options *common.ENOptions) string {
99100
client := resty.New()
101+
client.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true})
100102
client.SetTimeout(time.Duration(options.TimeOut) * time.Minute)
101103
if options.Proxy != "" {
102104
client.SetProxy(options.Proxy)

0 commit comments

Comments
 (0)