diff --git a/drivers/lanzou/driver.go b/drivers/lanzou/driver.go index ca719a41..acba5c70 100644 --- a/drivers/lanzou/driver.go +++ b/drivers/lanzou/driver.go @@ -125,13 +125,19 @@ func (driver Lanzou) Link(args base.Args, account *model.Account) (*base.Link, e } log.Debugf("down file: %+v", file) downId := file.Id + pwd := "" if account.InternalType == "cookie" { - downId, err = driver.GetDownPageId(file.Id, account) + downId, pwd, err = driver.GetDownPageId(file.Id, account) if err != nil { return nil, err } } - url, err := driver.GetLink(downId, account) + var url string + //if pwd != "" { + //url, err = driver.GetLinkWithPassword(downId, pwd, account) + //} else { + url, err = driver.GetLink(downId, pwd, account) + //} if err != nil { return nil, err } diff --git a/drivers/lanzou/lanzou.go b/drivers/lanzou/lanzou.go index 47a4c127..252918bd 100644 --- a/drivers/lanzou/lanzou.go +++ b/drivers/lanzou/lanzou.go @@ -165,29 +165,21 @@ func (driver *Lanzou) GetFilesByUrl(account *model.Account) ([]LanZouFile, error //} // GetDownPageId 获取下载页面的ID -func (driver *Lanzou) GetDownPageId(fileId string, account *model.Account) (string, error) { - var resp LanZouFilesResp +func (driver *Lanzou) GetDownPageId(fileId string, account *model.Account) (string, string, error) { + var resp DownPageResp res, err := base.RestyClient.R().SetResult(&resp).SetHeader("Cookie", account.AccessToken). SetFormData(map[string]string{ "task": "22", "file_id": fileId, }).Post("https://pc.woozooo.com/doupload.php") if err != nil { - return "", err + return "", "", err } log.Debug(res.String()) if resp.Zt != 1 { - return "", fmt.Errorf("%v", resp.Info) + return "", "", fmt.Errorf("%v", resp.Info) } - info, ok := resp.Info.(map[string]interface{}) - if !ok { - return "", fmt.Errorf("%v", resp.Info) - } - fid, ok := info["f_id"].(string) - if !ok { - return "", fmt.Errorf("%v", info["f_id"]) - } - return fid, nil + return resp.Info.FId, resp.Info.Pwd, nil } type LanzouLinkResp struct { @@ -196,7 +188,7 @@ type LanzouLinkResp struct { Zt int `json:"zt"` } -func (driver *Lanzou) GetLink(downId string, account *model.Account) (string, error) { +func (driver *Lanzou) GetLink(downId string, pwd string, account *model.Account) (string, error) { shareUrl := account.SiteUrl u, err := url.Parse(shareUrl) if err != nil { @@ -209,7 +201,7 @@ func (driver *Lanzou) GetLink(downId string, account *model.Account) (string, er } iframe := regexp.MustCompile(`