github.com/qjfoidnh/BaiduPCS-Go@v0.0.0-20231011165705-caa18a3765f3/internal/pcsfunctions/pcsdownload/download_link.go (about) 1 package pcsdownload 2 3 import ( 4 "github.com/qjfoidnh/BaiduPCS-Go/baidupcs" 5 "github.com/qjfoidnh/BaiduPCS-Go/internal/pcsconfig" 6 "net/url" 7 ) 8 9 func GetLocateDownloadLinks(pcs *baidupcs.BaiduPCS, pcspath string) (dlinks []*url.URL, err error) { 10 dInfo, pcsError := pcs.LocateDownload(pcspath) 11 if pcsError != nil { 12 return nil, pcsError 13 } 14 15 us := dInfo.URLStrings(pcsconfig.Config.EnableHTTPS) 16 if len(us) == 0 { 17 return nil, ErrDlinkNotFound 18 } 19 20 return us, nil 21 }