mirror of https://github.com/Xhofe/alist
				
				
				
			fix(189pc,baidu_photo,thunder): single link limit multithreading
							parent
							
								
									2de0da87fa
								
							
						
					
					
						commit
						a90ef201c7
					
				|  | @ -3,8 +3,6 @@ package _189pc | |||
| import ( | ||||
| 	"context" | ||||
| 	"net/http" | ||||
| 	"regexp" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| 
 | ||||
|  | @ -133,16 +131,17 @@ func (y *Yun189PC) Link(ctx context.Context, file model.Obj, args model.LinkArgs | |||
| 			"User-Agent": []string{base.UserAgent}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	// 获取链接有效时常
 | ||||
| 	strs := regexp.MustCompile(`(?i)expire[^=]*=([0-9]*)`).FindStringSubmatch(downloadUrl.URL) | ||||
| 	if len(strs) == 2 { | ||||
| 		timestamp, err := strconv.ParseInt(strs[1], 10, 64) | ||||
| 		if err == nil { | ||||
| 			expired := time.Duration(timestamp-time.Now().Unix()) * time.Second | ||||
| 			like.Expiration = &expired | ||||
| 	/* | ||||
| 		// 获取链接有效时常
 | ||||
| 		strs := regexp.MustCompile(`(?i)expire[^=]*=([0-9]*)`).FindStringSubmatch(downloadUrl.URL) | ||||
| 		if len(strs) == 2 { | ||||
| 			timestamp, err := strconv.ParseInt(strs[1], 10, 64) | ||||
| 			if err == nil { | ||||
| 				expired := time.Duration(timestamp-time.Now().Unix()) * time.Second | ||||
| 				like.Expiration = &expired | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	*/ | ||||
| 	return like, nil | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -6,7 +6,6 @@ import ( | |||
| 	"fmt" | ||||
| 	"net/http" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| 
 | ||||
| 	"github.com/alist-org/alist/v3/drivers/base" | ||||
| 	"github.com/alist-org/alist/v3/internal/errs" | ||||
|  | @ -329,13 +328,13 @@ func (d *BaiduPhoto) linkAlbum(ctx context.Context, file model.Obj, args model.L | |||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	exp := 8 * time.Hour | ||||
| 	//exp := 8 * time.Hour
 | ||||
| 	link := &model.Link{ | ||||
| 		URL: res.Header().Get("location"), | ||||
| 		Header: http.Header{ | ||||
| 			"User-Agent": []string{headers["User-Agent"]}, | ||||
| 		}, | ||||
| 		Expiration: &exp, | ||||
| 		//Expiration: &exp,
 | ||||
| 	} | ||||
| 	return link, nil | ||||
| } | ||||
|  | @ -365,13 +364,13 @@ func (d *BaiduPhoto) linkFile(ctx context.Context, file model.Obj, args model.Li | |||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	exp := 8 * time.Hour | ||||
| 	//exp := 8 * time.Hour
 | ||||
| 	link := &model.Link{ | ||||
| 		URL: downloadUrl.Dlink, | ||||
| 		Header: http.Header{ | ||||
| 			"User-Agent": []string{headers["User-Agent"]}, | ||||
| 		}, | ||||
| 		Expiration: &exp, | ||||
| 		//Expiration: &exp,
 | ||||
| 	} | ||||
| 	return link, nil | ||||
| } | ||||
|  |  | |||
|  | @ -4,10 +4,7 @@ import ( | |||
| 	"context" | ||||
| 	"fmt" | ||||
| 	"net/http" | ||||
| 	"regexp" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| 
 | ||||
| 	"github.com/alist-org/alist/v3/drivers/base" | ||||
| 	"github.com/alist-org/alist/v3/internal/driver" | ||||
|  | @ -255,14 +252,16 @@ func (xc *XunLeiCommon) Link(ctx context.Context, file model.Obj, args model.Lin | |||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	strs := regexp.MustCompile(`e=([0-9]*)`).FindStringSubmatch(lFile.WebContentLink) | ||||
| 	if len(strs) == 2 { | ||||
| 		timestamp, err := strconv.ParseInt(strs[1], 10, 64) | ||||
| 		if err == nil { | ||||
| 			expired := time.Duration(timestamp-time.Now().Unix()) * time.Second | ||||
| 			link.Expiration = &expired | ||||
| 	/* | ||||
| 		strs := regexp.MustCompile(`e=([0-9]*)`).FindStringSubmatch(lFile.WebContentLink) | ||||
| 		if len(strs) == 2 { | ||||
| 			timestamp, err := strconv.ParseInt(strs[1], 10, 64) | ||||
| 			if err == nil { | ||||
| 				expired := time.Duration(timestamp-time.Now().Unix()) * time.Second | ||||
| 				link.Expiration = &expired | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	*/ | ||||
| 	return link, nil | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 foxxorcat
						foxxorcat