您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
package main //51cto自动领豆 import ( "github.com/crufter/goquery" "fmt" "math/rand" "net/http/cookiejar" "net/http" "net/url" "io/ioutil" "strconv" ) //用户名和密码 const ( NAME = "username" PWD = "password" ) func main() { //设置cookie cookieJar,_ := cookiejar.New(nil) client := &http.Client{ Jar:cookieJar, } //获取CSRF隐藏字段 req , _ := http.NewRequest("GET","http://home.51cto.com/index",nil) req.Header.Set("User-Agent","'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1") req.Header.Set("Referer","http://home.51cto.com/index") req.Header.Set("Connection","[keep-alive]") res ,_ := client.Do(req) doc ,_ := goquery.Parse(res.Body) csrf := doc.Find("input").Val() //构造登陆认证数据 val := url.Values{} val.Set("LoginForm[username]",NAME) val.Set("LoginForm[password]",PWD) val.Set("_csrf",csrf) val.Set("LoginForm[rememberMe]","0") //登陆获取cookie client.PostForm("http://home.51cto.com/index",val) //构造领豆数据 val_down := url.Values{} val_down.Set("do","getfreecredits") random_num := strconv.Itoa(rand.Float64()) val_down.Set("t",random_num) //领豆 res_my ,_ := client.PostForm("http://down.51cto.com/download.php",val_down) body1 ,_ := ioutil.ReadAll(res_my.Body) fmt.Println(string(body1)) //领取无忧币 client.Get("https://blog.51cto.com/appApi/sign/sign") }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。