99 "encoding/json"
1010 "fmt"
1111 "io"
12- "net/http"
1312 "net/url"
1413 "strconv"
1514 "strings"
@@ -22,11 +21,9 @@ import (
2221 "github.com/OpenListTeam/OpenList/v4/internal/model"
2322 "github.com/OpenListTeam/OpenList/v4/pkg/http_range"
2423 "github.com/OpenListTeam/OpenList/v4/pkg/utils"
25- "github.com/aliyun/aliyun-oss-go-sdk/oss"
26-
2724 cipher "github.com/SheltonZhu/115driver/pkg/crypto/ec115"
28- crypto "github.com/SheltonZhu/115driver/pkg/crypto/m115"
2925 driver115 "github.com/SheltonZhu/115driver/pkg/driver"
26+ "github.com/aliyun/aliyun-oss-go-sdk/oss"
3027 "github.com/pkg/errors"
3128)
3229
@@ -108,60 +105,6 @@ func (d *Pan115) getUA() string {
108105 return fmt .Sprintf ("Mozilla/5.0 115Browser/%s" , appVer )
109106}
110107
111- func (d * Pan115 ) DownloadWithUA (pickCode , ua string ) (* driver115.DownloadInfo , error ) {
112- key := crypto .GenerateKey ()
113- result := driver115.DownloadResp {}
114- params , err := utils .Json .Marshal (map [string ]string {"pick_code" : pickCode })
115- if err != nil {
116- return nil , err
117- }
118-
119- data := crypto .Encode (params , key )
120-
121- bodyReader := strings .NewReader (url.Values {"data" : []string {data }}.Encode ())
122- reqUrl := fmt .Sprintf ("%s?t=%s" , driver115 .AndroidApiDownloadGetUrl , driver115 .Now ().String ())
123- req , _ := http .NewRequest (http .MethodPost , reqUrl , bodyReader )
124- req .Header .Set ("Content-Type" , "application/x-www-form-urlencoded" )
125- req .Header .Set ("Cookie" , d .Cookie )
126- req .Header .Set ("User-Agent" , ua )
127-
128- resp , err := d .client .Client .GetClient ().Do (req )
129- if err != nil {
130- return nil , err
131- }
132- defer resp .Body .Close ()
133-
134- body , err := io .ReadAll (resp .Body )
135- if err != nil {
136- return nil , err
137- }
138- if err := utils .Json .Unmarshal (body , & result ); err != nil {
139- return nil , err
140- }
141-
142- if err = result .Err (string (body )); err != nil {
143- return nil , err
144- }
145-
146- b , err := crypto .Decode (string (result .EncodedData ), key )
147- if err != nil {
148- return nil , err
149- }
150-
151- downloadInfo := struct {
152- Url string `json:"url"`
153- }{}
154- if err := utils .Json .Unmarshal (b , & downloadInfo ); err != nil {
155- return nil , err
156- }
157-
158- info := & driver115.DownloadInfo {}
159- info .PickCode = pickCode
160- info .Header = resp .Request .Header
161- info .Url .Url = downloadInfo .Url
162- return info , nil
163- }
164-
165108func (c * Pan115 ) GenerateToken (fileID , preID , timeStamp , fileSize , signKey , signVal string ) string {
166109 userID := strconv .FormatInt (c .client .UserID , 10 )
167110 userIDMd5 := md5 .Sum ([]byte (userID ))
@@ -309,7 +252,8 @@ func (c *Pan115) UploadByOSS(ctx context.Context, params *driver115.UploadOSSPar
309252
310253// UploadByMultipart upload by mutipart blocks
311254func (d * Pan115 ) UploadByMultipart (ctx context.Context , params * driver115.UploadOSSParams , fileSize int64 , s model.FileStreamer ,
312- dirID string , up driver.UpdateProgress , opts ... driver115.UploadMultipartOption ) (* UploadResult , error ) {
255+ dirID string , up driver.UpdateProgress , opts ... driver115.UploadMultipartOption ,
256+ ) (* UploadResult , error ) {
313257 var (
314258 chunks []oss.FileChunk
315259 parts []oss.UploadPart
0 commit comments