Repository: AlistGo/alist (language: go)

Issue:
挂载一刻相册时部分图片下载不了，看接口raw_url是空的
### Please make sure of the following things

- [X] I have read the [documentation](https://alist.nn.ci).
- [X] I'm sure there are no duplicate issues or discussions.
- [X] I'm sure it's due to `alist` and not something else(such as `Dependencies` or `Operational`).
- [X] I'm sure I'm using the latest version

### Alist Version / Alist 版本

v3.18.0

### Driver used / 使用的存储驱动

一刻相册

### Describe the bug / 问题描述

挂载一刻相册时部分图片下载不了，可以看缩略图，原图不行。
大部分正常，只有部分有问题
看接口raw_url是空的
![image](https://github.com/alist-org/alist/assets/53564732/2ac4e2e9-e861-48af-b367-40ae79711486)


### Reproduction / 复现链接

无

### Logs / 日志

_No response_


Discussion / hints:
Thanks for opening your first issue here! Be sure to follow the issue template!

大概率图被封了，去官方网站看看



> 大概率图被封了，去官方网站看看

图没有被封，官网正常，使用alist看缩略图也正常，就是看不了原图
什么图片 从一刻下载分享一下我试试~我试了十来张图没有发现这情况
> 什么图片 从一刻下载分享一下我试试~我试了十来张图没有发现这情况

https://photo.baidu.com/photo/wap/albumShare/invite/mferEsENYA?from=webcreate
你试试，就是普通的电影图片
![image](https://github.com/alist-org/alist/assets/53564732/2d7351a6-b6c5-4def-b951-c88a75242b00)

和你提到的同款文件   我下载没有问题
![image](https://github.com/alist-org/alist/assets/56105412/c80c15a8-bbd0-490b-99a0-83fb4bed4073)

也能看到`raw_url`参数
![image](https://github.com/alist-org/alist/assets/56105412/56c95d77-6b88-42a4-b961-41420caac6ab)

> 和你提到的同款文件 我下载没有问题 ![image](https://user-images.githubusercontent.com/56105412/246584766-c80c15a8-bbd0-490b-99a0-83fb4bed4073.png)
> 
> 也能看到`raw_url`参数 ![image](https://user-images.githubusercontent.com/56105412/246584796-56c95d77-6b88-42a4-b961-41420caac6ab.png)

不知道是不是一刻相册有访问频率限制，访问多了，总是有几个图片有问题。
之前有问题的，现在正常了.... 
又出现几个不正常的
或许可以用多给个账号共享相册负载均衡缓解这个问题

Fix patch:
diff --git a/drivers/baidu_photo/driver.go b/drivers/baidu_photo/driver.go
index ecb756da59d..2a55939fe99 100644
--- a/drivers/baidu_photo/driver.go
+++ b/drivers/baidu_photo/driver.go
@@ -126,7 +126,13 @@ func (d *BaiduPhoto) Link(ctx context.Context, file model.Obj, args model.LinkAr
 	case *File:
 		return d.linkFile(ctx, file, args)
 	case *AlbumFile:
-		return d.linkAlbum(ctx, file, args)
+		f, err := d.CopyAlbumFile(ctx, file)
+		if err != nil {
+			return nil, err
+		}
+		return d.linkFile(ctx, f, args)
+		// 有概率无法获取到链接
+		//return d.linkAlbum(ctx, file, args)
 	}
 	return nil, errs.NotFile
 }
diff --git a/drivers/baidu_photo/utils.go b/drivers/baidu_photo/utils.go
index 9715bdbfdf6..a50022b4663 100644
--- a/drivers/baidu_photo/utils.go
+++ b/drivers/baidu_photo/utils.go
@@ -3,6 +3,7 @@ package baiduphoto
 import (
 	"context"
 	"fmt"
+	"io"
 	"net/http"
 
 	"github.com/alist-org/alist/v3/drivers/base"
@@ -21,7 +22,7 @@ const (
 	FILE_API_URL_V2 = API_URL + "/file/v2"
 )
 
-func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error) {
+func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallback, resp interface{}) (*resty.Response, error) {
 	req := base.RestyClient.R().
 		SetQueryParam("access_token", d.AccessToken)
 	if callback != nil {
@@ -52,9 +53,17 @@ func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallba
 	default:
 		return nil, fmt.Errorf("errno: %d, refer to https://photo.baidu.com/union/doc", erron)
 	}
-	return res.Body(), nil
+	return res, nil
 }
 
+//func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error) {
+//	res, err := d.request(furl, method, callback, resp)
+//	if err != nil {
+//		return nil, err
+//	}
+//	return res.Body(), nil
+//}
+
 func (d *BaiduPhoto) refreshToken() error {
 	u := "https://openapi.baidu.com/oauth/2.0/token"
 	var resp base.TokenResp
@@ -79,11 +88,11 @@ func (d *BaiduPhoto) refreshToken() error {
 	return nil
 }
 
-func (d *BaiduPhoto) Get(furl string, callback base.ReqCallback, resp interface{}) ([]byte, error) {
+func (d *BaiduPhoto) Get(furl string, callback base.ReqCallback, resp interface{}) (*resty.Response, error) {
 	return d.Request(furl, http.MethodGet, callback, resp)
 }
 
-func (d *BaiduPhoto) Post(furl string, callback base.ReqCallback, resp interface{}) ([]byte, error) {
+func (d *BaiduPhoto) Post(furl string, callback base.ReqCallback, resp interface{}) (*resty.Response, error) {
 	return d.Request(furl, http.MethodPost, callback, resp)
 }
 
@@ -391,6 +400,49 @@ func (d *BaiduPhoto) linkFile(ctx context.Context, file *File, args model.LinkAr
 	return link, nil
 }
 
+func (d *BaiduPhoto) linkStreamAlbum(ctx context.Context, file *AlbumFile) (*model.Link, error) {
+	return &model.Link{
+		Header: http.Header{},
+		Writer: func(w io.Writer) error {
+			res, err := d.Get(ALBUM_API_URL+"/streaming", func(r *resty.Request) {
+				r.SetContext(ctx)
+				r.SetQueryParams(map[string]string{
+					"fsid":     fmt.Sprint(file.Fsid),
+					"album_id": file.AlbumID,
+					"tid":      fmt.Sprint(file.Tid),
+					"uk":       fmt.Sprint(file.Uk),
+				}).SetDoNotParseResponse(true)
+			}, nil)
+			if err != nil {
+				return err
+			}
+			defer res.RawBody().Close()
+			_, err = io.Copy(w, res.RawBody())
+			return err
+		},
+	}, nil
+}
+
+func (d *BaiduPhoto) linkStream(ctx context.Context, file *File) (*model.Link, error) {
+	return &model.Link{
+		Header: http.Header{},
+		Writer: func(w io.Writer) error {
+			res, err := d.Get(FILE_API_URL_V1+"/streaming", func(r *resty.Request) {
+				r.SetContext(ctx)
+				r.SetQueryParams(map[string]string{
+					"fsid": fmt.Sprint(file.Fsid),
+				}).SetDoNotParseResponse(true)
+			}, nil)
+			if err != nil {
+				return err
+			}
+			defer res.RawBody().Close()
+			_, err = io.Copy(w, res.RawBody())
+			return err
+		},
+	}, nil
+}
+
 // 获取uk
 func (d *BaiduPhoto) uInfo() (*UInfo, error) {
 	var info UInfo


Test patch: