From b954ee8392e4d4057dcd4c4e653eb676619c6b68 Mon Sep 17 00:00:00 2001 From: sunshineplan Date: Tue, 11 Jun 2024 15:41:12 +0800 Subject: [PATCH] Update cache package --- go.mod | 2 +- go.sum | 4 ++-- m3u8.go | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 52743d4..5c54f4e 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/sunshineplan/chrome v1.1.14 github.com/sunshineplan/gohttp v1.0.10 github.com/sunshineplan/useragent v1.0.1 - github.com/sunshineplan/utils v0.1.66 + github.com/sunshineplan/utils v0.1.67 ) require ( diff --git a/go.sum b/go.sum index c301d97..9ed76dd 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,8 @@ github.com/sunshineplan/gohttp v1.0.10 h1:yXV1Jc+kRLsS0gOr2kKs2jywhso+X422xzV+uO github.com/sunshineplan/gohttp v1.0.10/go.mod h1:aTmCdd7sOiBHDyFVDW9pTvX5ecRUOFym4zGN9DhwM18= github.com/sunshineplan/useragent v1.0.1 h1:0x4MIlcOQ2awc1XKUwEJr+fDcJXpm/bw1H7Hbi79PbY= github.com/sunshineplan/useragent v1.0.1/go.mod h1:u+8L7UYZqQI4iMgbMdhE1GldRohbrlQGZr5lzegPRLE= -github.com/sunshineplan/utils v0.1.66 h1:YwIuVQxmaL0bEnEKHU64pseCC18w2MZVtyrmY4VFOew= -github.com/sunshineplan/utils v0.1.66/go.mod h1:QMe2vCEFq9VliPac8WfXndi5jP0ZrPHus8wvJlgBy5M= +github.com/sunshineplan/utils v0.1.67 h1:YdeMbTryVv//6yka6qtNdgQqOifWVzR4kbCtw7v+imY= +github.com/sunshineplan/utils v0.1.67/go.mod h1:QMe2vCEFq9VliPac8WfXndi5jP0ZrPHus8wvJlgBy5M= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/m3u8.go b/m3u8.go index 990310a..8d62905 100644 --- a/m3u8.go +++ b/m3u8.go @@ -15,7 +15,7 @@ import ( "github.com/sunshineplan/utils/cache" ) -var c = cache.New(false) +var c = cache.New[string, []byte](false) func parse(url *url.URL, playlist m3u8.Playlist) (*url.URL, *m3u8.MediaPlaylist, error) { switch playlist := playlist.(type) { @@ -118,9 +118,8 @@ func read(s *m3u8.MediaSegment, file string) ([]byte, error) { } func getKey(url string) (b []byte, err error) { - value, ok := c.Get(url) + b, ok := c.Get(url) if ok { - b = value.([]byte) return }