Skip to content

Commit

Permalink
[huya] add error check (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
kira1928 committed May 31, 2024
1 parent 77674d7 commit dbb314b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/live/huya/huya.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,13 @@ func (l *Live) GetStreamUrls() (us []*url.URL, err error) {

tmpStrings := strings.Split(body, `stream: `)
if len(tmpStrings) < 2 {
return nil, fmt.Errorf("stream not found")
return nil, fmt.Errorf("stream json info not found")
}
streamJsonRawString := strings.Split(tmpStrings[1], `};`)[0]
tmpStreamJsonRawString := strings.Split(tmpStrings[1], `};`)
if len(tmpStreamJsonRawString) < 1 {
return nil, fmt.Errorf("stream json info end not found. stream text: %s", tmpStrings[1])
}
streamJsonRawString := tmpStreamJsonRawString[0]
if !gjson.Valid(streamJsonRawString) {
return nil, fmt.Errorf("streamJsonRawString not valid")
}
Expand Down

0 comments on commit dbb314b

Please sign in to comment.