MCPcopy Create free account
hub / github.com/FloatTech/AnimeAPI / Ptqrlogin

Function Ptqrlogin

qzone/api.go:67–90  ·  view source on GitHub ↗

Ptqrlogin 登录回调

(qrsig string, qrtoken string)

Source from the content-addressed store, hash-verified

65
66// Ptqrlogin 登录回调
67func Ptqrlogin(qrsig string, qrtoken string) (data []byte, cookie string, err error) {
68 client := &http.Client{
69 CheckRedirect: func(req *http.Request, via []*http.Request) error {
70 return http.ErrUseLastResponse
71 },
72 }
73 ptqrloginReq, err := http.NewRequest("GET", fmt.Sprintf(ptqrloginURL, qrtoken), nil)
74 if err != nil {
75 return
76 }
77 ptqrloginReq.Header.Add("cookie", "qrsig="+qrsig)
78 ptqrloginResp, err := client.Do(ptqrloginReq)
79 if err != nil {
80 return
81 }
82 defer ptqrloginResp.Body.Close()
83 for _, v := range ptqrloginReq.Cookies() {
84 if v.Value != "" {
85 cookie += v.Name + "=" + v.Value + ";"
86 }
87 }
88 data, err = io.ReadAll(ptqrloginResp.Body)
89 return
90}
91
92// LoginRedirect 登录成功回调
93func LoginRedirect(redirectURL string) (cookie string, err error) {

Callers 1

TestLoginFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestLoginFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…