browser - 我对新的 Twitch API 有一些疑问
问题描述
我为我的 twitch 频道创建了自己的浏览器扩展。
我使用 Twitch Kraken API 编写了 javascript 扩展,但它已被更改。
新的 Twitch API 是“ https://api.twitch.tv/helix/streams?game_id=33214 ”
我替换了代码中的 API,但扩展始终显示在线状态。
xhr.open('GET', this.API_URL_STREAM, true)
xhr.setRequestHeader('Accept', 'application/vnd.twitchtv.v5+json')
xhr.setRequestHeader('Client-ID', this.CLIENT_ID)
xhr.onreadystatechange = e => {
if (xhr.readyState == 4 && xhr.status == 200) {
const body = xhr.responseText
let json = {}
try {
json = JSON.parse(body)
} catch (e) {
console.info(e, xhr.responseText)
}
this.handle_response(json)
}
}
xhr.send(null)
}
我没有错误信息。我的直播总是处于在线状态,但我没有直播。
解决方案
推荐阅读
- regex - 删除 Atom 中现有文件的尾随换行符
- python - PostgreSQL。如何使用python复制一行中单元格的值并将其粘贴到同一表中另一行的另一个单元格中
- c# - AutoMapper - 具有多个相同类型属性的 ProjectTo 类
- php - 来自数据库的php数据不显示
- javascript - 显示进度条
- sql - 当字段为空时从 SQL 数据透视表中删除行
- json - 如何使用 Django DRF 将“CSV 杂乱数据”转换为“JSON 结构化数据”
- yii2 - Yii2:如何将数据库控制台迁移参数设置为数组
- .net - 为什么 DirectoryEntry.Invoke("SetPassword", value) 触发 Credential Required CryptoAPI Private Key
- c# - 在 C# 中实现部分递归函数