package main
import (
"fmt"
"net/http"
"errors"
)
func main() {
url:="https://www.baidu.com/link?url=IIZcBDQ9FSkK8wRluFkNAxjf4a7VDwHH0kFqGazjEAFGRDdnxe0HqQRdSocksxbbrpMjo7PTBeGjgnmf0aYOqN7ld6dXDBVO_jMYS16Yuy7CI5M_TMysMLpmFhF4CEjGjXOEYvjL_r9Hgz2-4jwsoa"
client := &http.Client{
CheckRedirect: myCheckRedirect,
}
req, err := http.NewRequest("GET", url, nil)
if err != nil{
}
resp, err := client.Do(req)
if err != nil{
}
fmt.Println(resp.Status)
respUrl,err := resp.Location()
if err != nil{
}
fmt.Println(respUrl.String())
}
func myCheckRedirect(req *http.Request, via []*http.Request) error {
//自用,将url根据需求进行组合
if len(via) >= 1 {
retu