python的twitch模块
twitch-python的Python项目详细描述
抽搐Python
pip install --user twitch-python
一种面向对象的方法,用于访问TwitchAPI,并使用关系和智能缓存进行实时聊天。
要求
使用量
# Twitch APIimporttwitchhelix=twitch.Helix('client-id')
# Usersforuserinhelix.users('sodapoppin','reckful',24250859):print(user.display_name)print(helix.user('zarlach').display_name)
# Videosforvideoinhelix.videos([318017128,317650435]):print(video.title)print(helix.video(318017128).title)
# Video Comments (VOD chat)forcommentinhelix.video(318017128).comments:print(comment.commenter.display_name)forvideo,commentsinhelix.videos([318017128,317650435]).comments:forcommentincomments:print(comment.commenter.display_name,comment.message.body)forvideo,commentsinhelix.user('sodapoppin').videos().comments:forcommentincomments:print(comment.commenter.display_name,comment.message.body)foruser,videosinhelix.users('sodapoppin','reckful').videos(first=5):forvideo,commentsinvideos.comments:forcommentincomments:print(comment.commenter.display_name,comment.message.body)
# Twitch Chattwitch.Chat(channel='#sodapoppin',nickname='zarlach',oauth='oauth:xxxxxx').subscribe(lambdamessage:print(message.channel,message.user.display_name,message.text))
功能
- 面向对象关系
- 智能缓存
- 新的Twitch API(螺旋)
- 来自Twitch API V5的视频点播聊天
Documentation•Twitch API•Twitch-Chat-Downloader