Skip to content

Commit

Permalink
修复AQC经常触发验证问题 fix #131 #121
Browse files Browse the repository at this point in the history
  • Loading branch information
keac committed Jul 30, 2024
1 parent 9bb2dda commit 70245b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 10 additions & 9 deletions internal/aiqicha/aiqicha.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ type AQC struct {
// AdvanceFilter 筛选过滤
func (h *AQC) AdvanceFilter() ([]gjson.Result, error) {
name := h.Options.KeyWord
//urls := "https://aiqicha.baidu.com/s?q=" + urlTool.QueryEscape(name) + "&t=0"
urls := "https://aiqicha.baidu.com/s/advanceFilterAjax?q=" + urlTool.QueryEscape(name) + "&p=1&s=10&f={}"
urls := "https://aiqicha.baidu.com/s?q=" + urlTool.QueryEscape(name) + "&t=0"
//urls := "https://aiqicha.baidu.com/s/advanceFilterAjax?q=" + urlTool.QueryEscape(name) + "&p=1&s=10&f={}"
content := GetReq(urls, h.Options)
content = strings.ReplaceAll(content, "<em>", "⌈")
content = strings.ReplaceAll(content, "<\\/em>", "⌋")
//rq := pageParseJson(content)
enList := gjson.Get(content, "data.resultList").Array()
ddw := gjson.Get(content, "ddw").Int()
rq, _ := pageParseJson(content)
enList := rq.Get("resultList").Array()
//enList := gjson.Get(content, "data.resultList").Array()
if len(enList) == 0 {
gologger.Debug().Str("查询请求", name).Msg(content)
return enList, fmt.Errorf("【AQC】没有查询到关键词 ⌈%s⌋", name)
}
// advanceFilterAjax 接口特殊处理
for i, v := range enList {
s, _ := sjson.Set(v.Raw, "pid", transformNumber(v.Get("pid").String(), ddw))
enList[i] = gjson.Parse(s)
}
//ddw := gjson.Get(content, "ddw").Int()
//for i, v := range enList {
// s, _ := sjson.Set(v.Raw, "pid", transformNumber(v.Get("pid").String(), ddw))
// enList[i] = gjson.Parse(s)
//}
return enList, nil
}

Expand Down
2 changes: 2 additions & 0 deletions internal/aiqicha/bean.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package aiqicha

import (
"crypto/tls"
"fmt"
"github.com/go-resty/resty/v2"
"github.com/tidwall/gjson"
Expand Down Expand Up @@ -97,6 +98,7 @@ func getENMap() map[string]*common.EnsGo {

func GetReq(url string, options *common.ENOptions) string {
client := resty.New()
client.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true})
client.SetTimeout(time.Duration(options.TimeOut) * time.Minute)
if options.Proxy != "" {
client.SetProxy(options.Proxy)
Expand Down

0 comments on commit 70245b9

Please sign in to comment.