This commit is contained in:
cdle
2021-09-15 15:20:28 +08:00
parent 2545606147
commit 6f1fe94e20
4 changed files with 46 additions and 19 deletions
+9 -1
View File
@@ -1132,7 +1132,15 @@ type UserInfoResult struct {
Timestamp int64 `json:"timestamp"`
}
func FetchJdCookieValue(key string, cookies string) string {
func FetchJdCookieValue(ps ...string) string {
var key, cookies string
if len(ps) == 2 {
if len(ps[0]) > len(ps[1]) {
key, cookies = ps[1], ps[0]
} else {
key, cookies = ps[0], ps[1]
}
}
match := regexp.MustCompile(key + `=([^;]*);{0,1}`).FindStringSubmatch(cookies)
if len(match) == 2 {
return match[1]