Skip to content

Commit

Permalink
Fix parse MasterPlaylist #116
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshineplan committed May 21, 2024
1 parent 637a891 commit e7ce15d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/sunshineplan/useragent"
)

var ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
var ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"

func DefaultUserAgent() string { return ua }

Expand Down
4 changes: 2 additions & 2 deletions m3u8.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ func parse(url *url.URL, playlist m3u8.Playlist) (*url.URL, *m3u8.MediaPlaylist,
})
if len(playlist.Variants) != 0 {
slog.Debug("Parse from master playlist:\n" + playlist.String())
u, err := url.Parse(playlist.Variants[0].URI)
ref, err := url.Parse(playlist.Variants[0].URI)
if err != nil {
return nil, nil, err
}
return FetchM3U8MediaPlaylist(u)
return FetchM3U8MediaPlaylist(url.ResolveReference(ref))
} else {
return nil, nil, fmt.Errorf("empty master playlist")
}
Expand Down

0 comments on commit e7ce15d

Please sign in to comment.