抖音官方开放接口
Project description
douyin-api
说明
抖音官网接口
开发者文档:https://developer.open-douyin.com/docs-page 移动/网站应用文档指引:https://developer.open-douyin.com/docs/resource/zh-CN/dop/overview/usage-guide
接口演示
from douyin_api import DouYin
from douyin_api.utils import Timer
from _.不要对外公开 import client_key, client_secret, redirect_uri, access_token, open_id, item_id, refresh_token
正式环境 = 'https://open.douyin.com'
沙盒环境 = 'https://open-sandbox.douyin.com'
if __name__ == '__main__':
with Timer() as timer:
...
d = DouYin(client_key, client_secret, 正式环境)
# print(d.client_token())
scope = 'user_info,video.list.bind,video.data.bind'
scope += ',trial.whitelist' # 测试的时候需要这个权限
# renew_refresh_token 用户授权续期
print(d.get_permission_code_url(scope=scope, redirect_uri=redirect_uri))
# print(d.access_token(code='9c1592704acfd7dbuQbpWj9u7EsBV8KuDbPT'))
# 刷新 refresh_token 的有效期
# print(d.renew_refresh_token(refresh_token))
# 刷新 refresh_token 的有效期
# print(d.refresh_token(refresh_token))
# 设置用户access_token,有些接口需要这个才能访问
d.set_access_token(access_token, open_id)
# print(d.userinfo())
# 分页获取用户所有视频的数据,返回的数据是实时的
# print(d.video_list(cursor=0, count=10))
# 查看设置用户access_token是否影响client_token接口访问
# print(d.client_token())
# 查询用户特定视频的数据,如点赞数、播放数等,返回的数据是实时的
# print(d.video_data(ids=[item_id]))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
douyin-api-0.1.1.tar.gz
(11.0 kB
view hashes)
Built Distribution
douyin_api-0.1.1-py3-none-any.whl
(10.5 kB
view hashes)
Close
Hashes for douyin_api-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1450ecc530dc054d8a6a1b7b8cd7cdaa5fbe085db6d1c44716c08392b6c54f97 |
|
MD5 | 55db12783e077cdc6add82f11410053a |
|
BLAKE2b-256 | 67e463153dd3fd3fe8cb1bc341e3a6686db37bdc27b4dc35861c3ff44b04fd86 |