Skip to content

Commit

Permalink
修正获取抖音的备选方法 (#709)
Browse files Browse the repository at this point in the history
  • Loading branch information
kira1928 authored May 5, 2024
1 parent 421c9a9 commit 31dfc42
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/live/douyin/douyin.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,23 @@ func (l *Live) legacy_GetInfo(body string) (info *live.Info, err error) {
if err != nil {
return nil, err
}
nickname := data.Get("data.user.nickname").String()
title := data.Get("data.data.0.title").String()
if title == "" {
title = nickname
}
isLiving := false
statusJson := data.Get("data.data.0.status")
if statusJson.Exists() {
isLiving = statusJson.Int() == 2
} else {
isLiving = data.Get("data.room_status").Int() == 0
}
info = &live.Info{
Live: l,
HostName: data.Get("user.nickname").String(),
RoomName: data.Get("data.0.title").String(),
Status: data.Get("data.0.status").Int() == 2,
HostName: nickname,
RoomName: title,
Status: isLiving,
}
return
}

0 comments on commit 31dfc42

Please sign in to comment.