Skip to content

Commit

Permalink
show: #4 add kuaishou support
Browse files Browse the repository at this point in the history
  • Loading branch information
luxcgo committed Apr 30, 2022
1 parent 2c6df3f commit 562d28a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 13 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Lives are delicate and fleeting creatures, waiting to be captured by us. ❤

> 全自动录播、投稿工具
>
> 支持抖音直播、虎牙直播、B站直播、油管直播、twitch直播
> 支持抖音直播、快手直播、虎牙直播、B站直播、油管直播、twitch直播
>
> 支持B站投稿
Expand Down Expand Up @@ -50,21 +50,25 @@ Filepath = ""
[PlatformConfig]
# 若有录制抖音直播,可在无痕模式非登录状态下找下面的 cookie 填入即可
DouyinCookie = "__ac_nonce=06245c89100e7ab2dd536; __ac_signature=_02B4Z6wo00f01LjBMSAAAIDBwA.aJ.c4z1C44TWAAEx696;"
# 若有录制快手直播,可在无痕模式非登录状态下找下面的 cookie 填入即可
KuaishouCookie = "did=web_d86297aa2f579589b8abc2594b0ea985"

[[Shows]]
# 平台名,目前支持:
# "bilibili"
# "douyin"
# "kuaishou"
# "huya"
# "youtube"
# "twitch"
Platform = "bilibili"
# 房间号,支持字符串类型的房间号
RoomID = "21852"
# 主播名称
StreamerName = "老番茄"
```

## Avanced
## Advanced

* **自定义视频文件名称**

Expand All @@ -87,12 +91,12 @@ StreamerName = "老番茄"

* **自定义视频下载器**

| 下载器 | 类型 | 支持平台 |
| ---------- | ------- | ----------------------- |
| streamlink | 第三方 | 油管<br />twitch |
| yt-dlp | 第三方 | 油管 |
| flv | go 原生 | 抖音<br />虎牙<br />B站 |
| ffmpeg | 第三方 | 抖音<br />虎牙<br />B站 |
| 下载器 | 类型 | 支持平台 |
| ---------- | ------- | --------------------------------- |
| streamlink | 第三方 | 油管<br />twitch |
| yt-dlp | 第三方 | 油管 |
| flv | go 原生 | 抖音<br />快手<br />虎牙<br />B站 |
| ffmpeg | 第三方 | 抖音<br />快手<br />虎牙<br />B站 |

油管、twitch 默认使用 streamlink

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/fsnotify/fsnotify v1.5.1
github.com/go-dora/filenamify v0.1.0
github.com/go-olive/flv v0.0.0-20220417125559-80092be84905
github.com/go-olive/tv v0.1.2
github.com/go-olive/tv v0.1.3-0.20220429170300-3f18776c1fdc
github.com/lthibault/jitterbug/v2 v2.2.2
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/sirupsen/logrus v1.8.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ github.com/go-olive/flv v0.0.0-20220417125559-80092be84905 h1:ZdAnmAn34asfJ3yUT6
github.com/go-olive/flv v0.0.0-20220417125559-80092be84905/go.mod h1:lEh2giuivi5AxQBVXcakIiXxusTWwnqgqz/8IvIYh+M=
github.com/go-olive/tv v0.1.2 h1:9OFFgHOcOhSv3RZQzm5YZpkSql85B02CtBOBgm7ex4w=
github.com/go-olive/tv v0.1.2/go.mod h1:e4Yq9X2H5wfuIKbo2+mtVVrDLuvoNw8CMqhJwADs8bY=
github.com/go-olive/tv v0.1.3-0.20220429170300-3f18776c1fdc h1:m2WefA6xyO7MVd/VG/jw3oljWkPMrrvwzfnyzmC0tl8=
github.com/go-olive/tv v0.1.3-0.20220429170300-3f18776c1fdc/go.mod h1:e4Yq9X2H5wfuIKbo2+mtVVrDLuvoNw8CMqhJwADs8bY=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down
3 changes: 2 additions & 1 deletion src/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ type UploadConfig struct {
}

type PlatformConfig struct {
DouyinCookie string
DouyinCookie string
KuaishouCookie string
}

func init() {
Expand Down
9 changes: 8 additions & 1 deletion src/engine/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ func WithParser(parser string) ShowOption {

func NewShow(platformType, roomID string, opts ...ShowOption) (Show, error) {
var cookie string
if platformType == "douyin" {
switch platformType {
case "douyin":
cookie = config.APP.PlatformConfig.DouyinCookie
case "kuaishou":
cookie = config.APP.PlatformConfig.KuaishouCookie
}

t, err := tv.New(platformType, roomID, tv.SetCookie(cookie))
if err != nil {
return nil, fmt.Errorf("Show init failed! err msg: %s", err.Error())
Expand Down Expand Up @@ -102,6 +106,9 @@ func (s *show) GetRoomID() string {
}

func (s *show) GetStreamerName() string {
if s.Streamer == "" {
s.Streamer, _ = s.StreamerName()
}
return s.Streamer
}

Expand Down
2 changes: 1 addition & 1 deletion src/recorder/recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func (r *recorder) record() {

r.show.Snap()
streamUrl, ok := r.show.StreamUrl()
roomName, _ := r.show.RoomName()
if !ok {
l.Logger.WithFields(logrus.Fields{
"pf": r.show.GetPlatform(),
Expand All @@ -116,6 +115,7 @@ func (r *recorder) record() {
time.Sleep(5 * time.Second)
return
}
roomName, _ := r.show.RoomName()

info := &struct {
StreamerName string
Expand Down
7 changes: 6 additions & 1 deletion src/tmpl/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Filepath = ""

[PlatformConfig]
DouyinCookie = "__ac_nonce=06245c89100e7ab2dd536; __ac_signature=_02B4Z6wo00f01LjBMSAAAIDBwA.aJ.c4z1C44TWAAEx696;"
KuaishouCookie = "did=web_d86297aa2f579589b8abc2594b0ea985"

[[Shows]]
Platform = "bilibili"
Expand All @@ -29,4 +30,8 @@ StreamerName = "wtt"
[[Shows]]
Platform = "twitch"
RoomID = "leekbeats"
StreamerName = "LeekBeats"
StreamerName = "LeekBeats"

[[Shows]]
Platform = "kuaishou"
RoomID = "3x35ta8wpyngjwk"

0 comments on commit 562d28a

Please sign in to comment.