Project

douyin_sdk

0.0
No commit activity in last 3 years
No release in over 3 years
Douyin SDK for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.17
~> 12.3.3
~> 3.0
 Project Readme

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.