Commit c247aa3b authored by anqi-wmm's avatar anqi-wmm

生产 sensor_data

测试成功
parent c6258462
...@@ -50,10 +50,10 @@ func abckSensor(client tls_client.HttpClient, sensorurl string) string { ...@@ -50,10 +50,10 @@ func abckSensor(client tls_client.HttpClient, sensorurl string) string {
req.Header.Set("referer", "https://www.spirit.com/") req.Header.Set("referer", "https://www.spirit.com/")
req.Header.Set("user-agent", rsss[1]) req.Header.Set("user-agent", rsss[1])
resp, _ := client.Do(req) resp, _ := client.Do(req)
readBytes, _ := io.ReadAll(resp.Body) //readBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(readBytes)) //fmt.Println(string(readBytes))
for _, cookie := range resp.Cookies() { for _, cookie := range resp.Cookies() {
fmt.Println(cookie.Name, len(cookie.Value), cookie.Value) fmt.Println(cookie.Name, len(cookie.Value))
} }
ua = rsss[1] ua = rsss[1]
} }
...@@ -62,7 +62,7 @@ func abckSensor(client tls_client.HttpClient, sensorurl string) string { ...@@ -62,7 +62,7 @@ func abckSensor(client tls_client.HttpClient, sensorurl string) string {
func main() { func main() {
wg := &sync.WaitGroup{} wg := &sync.WaitGroup{}
for i := 0; i < 1; i++ { for i := 0; i < 10; i++ {
wg.Add(1) wg.Add(1)
go func() { go func() {
jar := tls_client.NewCookieJar() jar := tls_client.NewCookieJar()
...@@ -80,12 +80,12 @@ func main() { ...@@ -80,12 +80,12 @@ func main() {
fmt.Println(px) fmt.Println(px)
options := []tls_client.HttpClientOption{ options := []tls_client.HttpClientOption{
tls_client.WithTimeoutSeconds(30), tls_client.WithTimeoutSeconds(30),
tls_client.WithClientProfile(tls_client.Chrome_110), tls_client.WithClientProfile(tls_client.Chrome_108),
tls_client.WithNotFollowRedirects(), tls_client.WithNotFollowRedirects(),
tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument
tls_client.WithProxyUrl("http://127.0.0.1:8890"), //tls_client.WithProxyUrl("http://127.0.0.1:8890"),
//tls_client.WithProxyUrl("http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"), tls_client.WithProxyUrl("http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"),
//tls_client.WithProxyUrl(px), tls_client.WithProxyUrl(px),
tls_client.WithInsecureSkipVerify(), tls_client.WithInsecureSkipVerify(),
} }
client, err := tls_client.NewHttpClient(tls_client.NewNoopLogger(), options...) client, err := tls_client.NewHttpClient(tls_client.NewNoopLogger(), options...)
...@@ -104,7 +104,7 @@ func main() { ...@@ -104,7 +104,7 @@ func main() {
req.Header.Set("accept-language", "en-US,en;q=0.9") req.Header.Set("accept-language", "en-US,en;q=0.9")
req.Header.Set("User-Agent", "Mozilla/5.0 (Linux; Android 9; SM-N9500) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Mobile Safari/537.36") req.Header.Set("User-Agent", "Mozilla/5.0 (Linux; Android 9; SM-N9500) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Mobile Safari/537.36")
resp, _ := client.Do(req) resp, _ := client.Do(req)
fmt.Println(resp.StatusCode)
doc, err := goquery.NewDocumentFromReader(resp.Body) doc, err := goquery.NewDocumentFromReader(resp.Body)
if err != nil { if err != nil {
panic(err) panic(err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment