fix(pikpak&pikpak_share): captcha_sign error (#7530 close #7481 close #7482)

This commit is contained in:
YangXu
2024-11-21 22:40:39 +08:00
committed by GitHub
parent 4c0cffd29b
commit 2dec756f23
6 changed files with 71 additions and 268 deletions

View File

@ -14,7 +14,6 @@ import (
log "github.com/sirupsen/logrus"
"golang.org/x/oauth2"
"net/http"
"regexp"
"strconv"
"strings"
)
@ -49,7 +48,6 @@ func (d *PikPak) Init(ctx context.Context) (err error) {
d.Common.CaptchaToken = token
op.MustSaveDriverStorage(d)
},
LowLatencyAddr: "",
}
}
@ -138,14 +136,6 @@ func (d *PikPak) Init(ctx context.Context) (err error) {
d.Addition.RefreshToken = d.RefreshToken
op.MustSaveDriverStorage(d)
if d.UseLowLatencyAddress && d.Addition.CustomLowLatencyAddress != "" {
d.Common.LowLatencyAddr = d.Addition.CustomLowLatencyAddress
} else if d.UseLowLatencyAddress {
d.Common.LowLatencyAddr = findLowestLatencyAddress(DlAddr)
d.Addition.CustomLowLatencyAddress = d.Common.LowLatencyAddr
op.MustSaveDriverStorage(d)
}
return nil
}
@ -188,12 +178,6 @@ func (d *PikPak) Link(ctx context.Context, file model.Obj, args model.LinkArgs)
url = resp.Medias[0].Link.Url
}
if d.UseLowLatencyAddress && d.Common.LowLatencyAddr != "" {
// 替换为加速链接
re := regexp.MustCompile(`https://[^/]+/download/`)
url = re.ReplaceAllString(url, "https://"+d.Common.LowLatencyAddr+"/download/")
}
return &model.Link{
URL: url,
}, nil