mirror of https://github.com/Xhofe/alist
parent
0a8d710e01
commit
8e2b9c681a
|
@ -148,6 +148,7 @@ func (d *ILanZou) Link(ctx context.Context, file model.Obj, args model.LinkArgs)
|
|||
res, err := base.NoRedirectClient.R().SetHeaders(map[string]string{
|
||||
//"Origin": d.conf.site,
|
||||
"Referer": d.conf.site + "/",
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0",
|
||||
}).Get(realURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -155,8 +156,13 @@ func (d *ILanZou) Link(ctx context.Context, file model.Obj, args model.LinkArgs)
|
|||
if res.StatusCode() == 302 {
|
||||
realURL = res.Header().Get("location")
|
||||
} else {
|
||||
contentLengthStr := res.Header().Get("Content-Length")
|
||||
contentLength, err := strconv.Atoi(contentLengthStr)
|
||||
if err != nil || contentLength == 0 || contentLength > 1024*10 {
|
||||
return nil, fmt.Errorf("redirect failed, status: %d", res.StatusCode())
|
||||
}
|
||||
return nil, fmt.Errorf("redirect failed, content: %s", res.String())
|
||||
}
|
||||
link := model.Link{URL: realURL}
|
||||
return &link, nil
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ func init() {
|
|||
bucket: "wpanstore-lanzou",
|
||||
unproved: "unproved",
|
||||
proved: "proved",
|
||||
devVersion: "122",
|
||||
devVersion: "125",
|
||||
site: "https://www.ilanzou.com",
|
||||
},
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ func init() {
|
|||
bucket: "wpanstore",
|
||||
unproved: "ws",
|
||||
proved: "app",
|
||||
devVersion: "121",
|
||||
devVersion: "125",
|
||||
site: "https://www.feijipan.com",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ func (d *ILanZou) request(pathname, method string, callback base.ReqCallback, pr
|
|||
req.SetHeaders(map[string]string{
|
||||
"Origin": d.conf.site,
|
||||
"Referer": d.conf.site + "/",
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0",
|
||||
})
|
||||
if proved {
|
||||
req.SetQueryParam("appToken", d.Token)
|
||||
|
|
Loading…
Reference in New Issue