我正在尝试阅读猫频道抽搐的消息。为此,我读了一些指南,我知道它必须经过IRC抽搐。然后我找到了几行简单的代码。在
import socket
import string
HOST="irc.twitch.tv"
PORT=6667
NICK="TwitchUsername"
IDENT="TwitchUsername"
REALNAME="TwitchUsername"
CHANNEL="#ChannelNameHere"
PASSWORD="OAuth Password here" #From http://twitchapps.com/tmi/
readbuffer=""
s=socket.socket( )
s.connect((HOST, PORT))
s.send("PASS %s\r\n" % PASSWORD)
s.send("NICK %s\r\n" % NICK)
s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
s.send("JOIN %s\r\n" % CHANNEL)
while 1:
readbuffer=readbuffer+s.recv(1024)
temp=string.split(readbuffer, "\n")
readbuffer=temp.pop( )
for line in temp:
line=string.rstrip(line)
line=string.split(line)
if len(line) > 3:
print line
if(line[0]=="PING"):
s.send("PONG %s\r\n" % line[1])
但是,身份验证没有按计划进行,因为我收到以下消息:
^{pr2}$我使用的是一个有效的OAuth聊天密码,我看不出任何理由可以证明这个失败。当你尝试使用你的用户名时,你也有错误吗?或者你知道这个问题吗?在
我也看到了同样的
:tmi.twitch.tv NOTICE * :Error logging in
。在如自述文件"Your nickname must be your Twitch username in lowercase"中所述。在
{我的用户名不是一个很有信息的问题。所以希望这能为其他人节省一些时间。在
您的OAuth密码需要发送为:
这意味着,如果将令牌放入没有oauth:前缀的PASSWORD变量中,则应将pass line修改为:
^{pr2}$相关问题 更多 >
编程相关推荐