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
export http_proxy=http://172.17.42.1:8118export https_proxy=$http_proxyexport ftp_proxy=$http_proxyexport rsync_proxy=$http_proxyexport no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"source /etc/profile
by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交流群:217722918
mail: liuyg#liuyingguang.cn
博主首页(==防止爬虫==):http://blog.liuyingguang.cn