【问题标题】:Twitch Ban Checker抽搐禁令检查器
【发布时间】:2020-04-30 22:51:51
【问题描述】:

你能帮我处理我的 Twitch Ban Checker

几个月前还有效,但现在出了点问题 也许有人可以给我一个提示,为什么它不再起作用了 我写了这个 Twitch Ban Checker,在输入用户名后,它会给出你是否被 Twitch 禁止的答案

该应用也在 codepen https://codepen.io/olthoffs/pen/zqxbWW

var check_user = function (user) {
            $(".description").fadeOut(20)

            $.getJSON('https://api.twitch.tv/kraken/users/' + encodeURIComponent(user) + '?callback=?').done(function (data) {
                if (/.+is unavailable$/.test(data.message)) { // Ban Check
                    var message = 'It looks like you were banned from twitch, please open a ticket via the '
                    message += '<a target="_blank" href="https://help.twitch.tv/customer/portal/emails/new?interaction[name]=' + user + '">official twitch support</a> '
                    message += 'site in order to see why you were banned.<br />'
                    message += '<span>TwitchTips cannot and will not help with your appeal</span>'
                    form_result('fail', message)
                } else if (/.+is not available on Twitch$/.test(data.message) || /.+does not exist$/.test(data.message)) { // JTV/Nonexistant Check
                    var message = 'That account is either not a Twitch account or it does not exist.'
                    form_result('warn', message)
                } else {
                    var message = 'The account provided does not seem to be banned on Twitch. '
                    message += 'If you\'re seeing a message telling you that you\'re blocked from Twitch, '
                    message += 'try disabling any VPN, proxy, or extension which re-routes traffic from your browser.<br/><br/>'
                    message += 'Got multiple accounts? Try checking those too because Twitch bans can be IP based.<br/><br/>'
                    message += 'If after doing so you are still getting the same error, '
                    message += 'your ISP may have provided your modem with a previously banned IP address. '
                    message += 'You can <a style="color: #fff" href="https://help.twitch.tv/customer/portal/emails/new?interaction[name]=' + user + '" target="_blank"><strong>open a ticket</strong></a> with Twitch to check.'
                    form_result('success', message)
                }
            }).fail(function () {
                form_result('warn', 'The Twitch API appears to have returned an invalid response. Twitch may be having issues at the moment.')
            })  
        }
        var form_result = function (type, message) {
            if (type === 'success') {
                var title = "All is well!"
            } else if (type === 'warn') {
                var title = "Hmm, That's not right!"
            } else {
                var title = "Oh dear!"
            }

            $('.result').attr('class', 'result')
            $('.result').html('<h3>' + title + '</h3>' + message)
            $('.result').addClass(type)
            $(".result").fadeIn()
        }

        $(document).ready(function () {
            $('#ban-check').submit(function (e) {
                e.preventDefault()
            })

            $('#ban-check').keyup(function (e) {
                if (e.keyCode !== 13) {
                    return
                }

                e.preventDefault()

                var user = $('#ban-check input').val()
            window.location.hash = '#' + user
            check_user(user)
            })
            var hash = location.hash
            if (hash) {
                var user = hash.substr(1)
                $('#ban-check input').val(user)
                check_user(user)
            }
        })

【问题讨论】:

  • 您的问题到底是什么?
  • 如果我输入 twitch 用户名,我什至没有得到答案,甚至没有错误消息

标签: javascript json api twitch


【解决方案1】:

获取https://api.twitch.tv/kraken/users (在标头中带有客户端 ID) 返回:

{
"error": "Gone",
"status": 410,
"message": "It's time to kick ass and serve v3... and I'm all outta v3. See https://dev.twitch.tv/docs"
}

您可能需要切换到 helix,并通过 OAuth 流程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-25
    • 1970-01-01
    • 2014-06-07
    • 1970-01-01
    • 1970-01-01
    • 2015-06-28
    相关资源
    最近更新 更多