Skip to content

About

抖音SDK ruby版本(非官方)

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

DouyinSdk

Douyin SDK for Ruby

Installation

Add this line to your application's Gemfile:

gem 'douyin_sdk'

And then execute:

$ bundle

Or install it yourself as:

$ gem install douyin_sdk

Usage

1.配置 ClientKey 和 ClientSecret

$client = DouyinSdk::Client.new(client_key, client_secret)
  • 抖音Oauth 2授权

1.获取用户授权链接:

$client.auth_code_url(redirect_uri, scope)

reirect_url为回调接收地址,scope为要获取的权限,详见官方文档

2.用户扫码授权后,根据code获取用户access_token,open_id和refresh_token等信息

$client.access_token(code)
  • 刷新access_token
$client.refresh_token(refresh_token)
  • 刷新refresh_token

通过旧的refresh_token获取新的refresh_token,调用后旧refresh_token会失效,新refresh_token有30天有效期。最多只能获取5次新的refresh_token,5次过后需要用户重新授权。

$client.renew_refresh_token(client_key, refresh_token)
  • 获取用户公开信息
$client.user_info(access_token, open_id)
  • 获取粉丝列表(需要在开放平台申请用户管理接口权限)
$client.fan_list(access_token, open_id)
  • 查询授权账号视频数据
$client.video_list(access_token, open_id)
  • 查询指定视频数据

    item_id为抖音视频id

$client.video_data(access_token, open_id, item_id)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/dhuSaverin/douyin_sdk. This project is intended to be a safe, welcoming space for collaboration.

License

The gem is available as open source under the terms of the MIT License.

About

抖音SDK ruby版本(非官方)

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages