fix(189pc,baidu_photo,thunder): single link limit multithreading

This commit is contained in:
foxxorcat
2022-09-13 18:44:07 +08:00
parent 2de0da87fa
commit a90ef201c7
3 changed files with 23 additions and 26 deletions

View File

@ -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
}